test(tests/lean/run/def13): add map-like test for dependent patter matching
This commit is contained in:
parent
cb7c82fdd5
commit
204d950a5f
1 changed files with 20 additions and 0 deletions
20
tests/lean/run/def13.lean
Normal file
20
tests/lean/run/def13.lean
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
set_option new_elaborator true
|
||||
|
||||
inductive vec (A : Type) : nat → Type
|
||||
| nil {} : vec 0
|
||||
| cons : Π {n}, A → vec n → vec (n+1)
|
||||
|
||||
open vec
|
||||
|
||||
variables {A : Type}
|
||||
variables f : A → A → A
|
||||
|
||||
definition map_head_1 : ∀ {n}, vec A n → vec A n → vec A n
|
||||
| .0 nil nil := nil
|
||||
| .(n+1) (@cons .A n a va) (cons b vb) := cons (f a b) va
|
||||
|
||||
example : map_head_1 f nil nil = nil :=
|
||||
rfl
|
||||
|
||||
example (a b : A) (n : nat) (va vb : vec A n) : map_head_1 f (cons a va) (cons b vb) = cons (f a b) va :=
|
||||
rfl
|
||||
Loading…
Add table
Reference in a new issue