lean4-htt/old_tests/tests/lean/run/1315b.lean
2018-04-10 12:56:55 -07:00

61 lines
997 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

open nat
def k : := 0
def fails : Π (n : ) (m : ),
| 0 m := 0
| (succ n) m :=
match k with
| 0 := 0
| (succ i) :=
let val := m+1 in
match fails n val with
| 0 := 0
| (succ l) := 0
end
end
def test (k : ) : Π (n : ) (m : ),
| 0 m := 0
| (succ n) m :=
match k with
| 0 := 1
| (succ i) :=
let val := m+1 in
match test n val with
| 0 := 2
| (succ l) := 3
end
end
example (k m : ) : test k 0 m = 0 :=
rfl
example (m n : ) : test 0 (succ n) m = 1 :=
rfl
example (k m : ) : test (succ k) 1 m = 2 :=
rfl
example (k m : ) : test (succ k) 2 m = 3 :=
rfl
example (k m : ) : test (succ k) 3 m = 3 :=
rfl
open tactic
run_cmd do
t ← infer_type `(test._match_2),
trace t,
tactic.interactive.guard_expr_eq t ```(nat → nat)
example (k m n : ) : test (succ k) (succ (succ n)) m = 3 :=
begin
revert m,
induction n with n',
{ intro, reflexivity},
{ intro,
simp [test, n_ih] }
end