This upstreams the solve_by_elim tactic from Std. It is a key tactic needed by library_search.
24 lines
579 B
Text
24 lines
579 B
Text
/-
|
||
Copyright (c) 2017 Mario Carneiro. All rights reserved.
|
||
Released under Apache 2.0 license as described in the file LICENSE.
|
||
Authors: Mario Carneiro, Yury G. Kudryashov
|
||
-/
|
||
prelude
|
||
import Init.Core
|
||
|
||
namespace Sum
|
||
|
||
deriving instance DecidableEq for Sum
|
||
deriving instance BEq for Sum
|
||
|
||
/-- Check if a sum is `inl` and if so, retrieve its contents. -/
|
||
def getLeft? : α ⊕ β → Option α
|
||
| inl a => some a
|
||
| inr _ => none
|
||
|
||
/-- Check if a sum is `inr` and if so, retrieve its contents. -/
|
||
def getRight? : α ⊕ β → Option β
|
||
| inr b => some b
|
||
| inl _ => none
|
||
|
||
end Sum
|