test(tests/lean/extra): more tests for equation elaborator
This commit is contained in:
parent
477d79ae47
commit
c9365db41b
3 changed files with 43 additions and 0 deletions
8
tests/lean/extra/rec3.lean
Normal file
8
tests/lean/extra/rec3.lean
Normal file
|
@ -0,0 +1,8 @@
|
|||
set_option pp.implicit true
|
||||
set_option pp.notation false
|
||||
|
||||
definition symm : Π {A : Type} {a b : A}, a = b → b = a,
|
||||
symm rfl := rfl
|
||||
|
||||
definition trans : Π {A : Type} {a b c : A}, a = b → b = c → a = c,
|
||||
trans rfl rfl := rfl
|
9
tests/lean/extra/rec4.lean
Normal file
9
tests/lean/extra/rec4.lean
Normal file
|
@ -0,0 +1,9 @@
|
|||
import data.vector
|
||||
open nat vector
|
||||
|
||||
set_option pp.implicit true
|
||||
set_option pp.notation false
|
||||
|
||||
definition diag {A : Type} : Π {n}, vector (vector A n) n → vector A n,
|
||||
diag nil := nil,
|
||||
diag ((a :: va) :: vs) := a :: diag (map tail vs)
|
26
tests/lean/extra/rec5.lean
Normal file
26
tests/lean/extra/rec5.lean
Normal file
|
@ -0,0 +1,26 @@
|
|||
import data.list
|
||||
open nat list
|
||||
|
||||
set_option pp.implicit true
|
||||
set_option pp.notation false
|
||||
|
||||
definition filter {A : Type} (p : A → Prop) [H : decidable_pred p] : list A → list A,
|
||||
filter nil := nil,
|
||||
filter (h :: t) := if p h then h :: filter t else filter t
|
||||
|
||||
open decidable
|
||||
|
||||
definition decidable_eq_nat : Π (a b : nat), decidable (a = b),
|
||||
decidable_eq_nat 0 0 := inl rfl,
|
||||
decidable_eq_nat 0 (x+1) := inr (ne.symm (succ_ne_zero x)),
|
||||
decidable_eq_nat (x+1) 0 := inr (succ_ne_zero x),
|
||||
decidable_eq_nat (x+1) (y+1) :=
|
||||
decidable.cases_on (decidable_eq_nat x y)
|
||||
(λ Hp, inl (congr_arg succ Hp))
|
||||
(λ Hn, inr (λ H : x+1 = y+1, absurd (succ.inj H) Hn))
|
||||
|
||||
/-
|
||||
match (decidable_eq_nat x y) with
|
||||
(inl Hp) := inl (congr_arg succ Hp),
|
||||
(inr Hn) := inr (λ Hs, absurd (succ.inj Hs) Hn)
|
||||
-/
|
Loading…
Reference in a new issue