test: MatchEqs.lean
This commit is contained in:
parent
aba0a479ec
commit
d37d340bb0
2 changed files with 17 additions and 1 deletions
|
|
@ -30,3 +30,6 @@ theorem ex (x : List Nat) : f x > 0 := by
|
|||
. decide
|
||||
. exact h1
|
||||
. exact h2
|
||||
|
||||
test% Std.RBNode.balance1.match_1
|
||||
#check @Std.RBNode.balance1.match_1.splitter
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ def f (xs : List Nat) : Nat :=
|
|||
| [a, b] => (a + b).succ
|
||||
| _ => 2
|
||||
|
||||
theorem ex (xs : List Nat) (hr : xs.reverse = xs) (ys : Nat) : ys > 0 → f xs > 0 := by
|
||||
theorem ex1 (xs : List Nat) (hr : xs.reverse = xs) (ys : Nat) : ys > 0 → f xs > 0 := by
|
||||
simp [f]
|
||||
split
|
||||
next => intro hys; simp
|
||||
|
|
@ -14,3 +14,16 @@ theorem ex (xs : List Nat) (hr : xs.reverse = xs) (ys : Nat) : ys > 0 → f xs >
|
|||
rw [f.match_1.eq_3]
|
||||
anyGoals assumption
|
||||
decide
|
||||
|
||||
def g (xs : List Nat) : Nat :=
|
||||
match xs with
|
||||
| [a, b, c, d, e] => a + e + 1
|
||||
| _ => 1
|
||||
|
||||
theorem ex2 (xs : List Nat) : g xs > 0 := by
|
||||
simp [g]
|
||||
split
|
||||
. simp; apply Nat.zero_lt_succ
|
||||
. rw [g.match_1.eq_2]
|
||||
. decide
|
||||
. assumption
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue