test(tests/lean/run): add more overlapping patterns examples
This commit is contained in:
parent
b46c377aa2
commit
fd332e411d
2 changed files with 38 additions and 0 deletions
22
tests/lean/run/eq12.lean
Normal file
22
tests/lean/run/eq12.lean
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
open nat bool inhabited
|
||||||
|
|
||||||
|
definition diag : bool → bool → bool → nat,
|
||||||
|
diag _ tt ff := 1,
|
||||||
|
diag ff _ tt := 2,
|
||||||
|
diag tt ff _ := 3,
|
||||||
|
diag _ _ _ := default nat
|
||||||
|
|
||||||
|
theorem diag1 (a : bool) : diag a tt ff = 1 :=
|
||||||
|
bool.cases_on a rfl rfl
|
||||||
|
|
||||||
|
theorem diag2 (a : bool) : diag ff a tt = 2 :=
|
||||||
|
bool.cases_on a rfl rfl
|
||||||
|
|
||||||
|
theorem diag3 (a : bool) : diag tt ff a = 3 :=
|
||||||
|
bool.cases_on a rfl rfl
|
||||||
|
|
||||||
|
theorem diag4_1 : diag ff ff ff = default nat :=
|
||||||
|
rfl
|
||||||
|
|
||||||
|
theorem diag4_2 : diag tt tt tt = default nat :=
|
||||||
|
rfl
|
16
tests/lean/run/eq13.lean
Normal file
16
tests/lean/run/eq13.lean
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
open nat inhabited
|
||||||
|
|
||||||
|
definition f : nat → nat → nat,
|
||||||
|
f _ 0 := 0,
|
||||||
|
f 0 _ := 1,
|
||||||
|
f _ _ := 2
|
||||||
|
|
||||||
|
theorem f_zero_right : ∀ a, f a 0 = 0,
|
||||||
|
f_zero_right 0 := rfl,
|
||||||
|
f_zero_right (succ _) := rfl
|
||||||
|
|
||||||
|
theorem f_zero_succ (a : nat) : f 0 (a+1) = 1 :=
|
||||||
|
rfl
|
||||||
|
|
||||||
|
theorem f_succ_succ (a b : nat) : f (a+1) (b+1) = 2 :=
|
||||||
|
rfl
|
Loading…
Reference in a new issue