lean4-htt/tests/lean/run/do_match_else.lean
Leonardo de Moura 572751c56e feat(frontends/lean): force user to use meta keyword on meta inductive/structure/class
Before this commit, we were inferring whether an
inductive/structure/class were meta or not. This was bad since the user
had no clue whether the type was trusted (non meta) or not.
Moreover, users could get confused by this behavior and assume the
kernel was allowing trusted code to rely on untrusted one.
2016-09-29 17:56:35 -07:00

18 lines
562 B
Text

open tactic
set_option pp.all true
meta def app2 (f a b : expr) :=
expr.app (expr.app f a) b
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,
H ← get_local `H >>= infer_type,
(lhs, rhs) ← match_eq H,
nat_add : expr ← mk_const `nat.add,
p : pattern ← mk_pattern [] [a, b] (app2 nat_add a b) [app2 nat_add b a, a, b],
trace (pattern.output p),
[v₁, v₂, v₃] ← match_pattern p lhs | failed,
trace v₁, trace v₂, trace v₃,
constructor