lean4-htt/tests/lean/run/match_pattern1.lean
Leonardo de Moura f0352d31a1 feat(library/type_context, library): inout ==> out modifier in type class declarations
@kha: I decided to implement this change before I start the
type_context modifications. The change did not affect the corelib and
test suite much. The only annoying problem is that `out` cannot be
used to name locals anymore.
2017-12-15 14:46:47 -08: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.moutput p),
H ← get_local `H >>= infer_type,
lhs_rhs ← match_eq H,
r ← match_pattern p (prod.fst lhs_rhs),
trace r,
constructor