lean4-htt/tests/lean/run/match_pattern1.lean
2016-09-21 09:48:39 -07:00

15 lines
495 B
Text

open tactic expr
set_option pp.all true
example (a b c x y : nat) (H : nat.add (nat.add x y) y = 0) : true :=
by do
a ← get_local `a, b ← get_local `b, c ← get_local `c,
nat_add : expr ← mk_const `nat.add,
p : pattern ← mk_pattern [] [a, b] (app_of_list nat_add [a, b]) [app_of_list nat_add [b, a], a, b],
trace (pattern.output p),
H ← get_local `H >>= infer_type,
lhs_rhs ← match_eq H,
out ← match_pattern p (prod.fst lhs_rhs),
trace out,
constructor