test(tests/lean/run/ematch1): add ematching example
This commit is contained in:
parent
15f1c6bab2
commit
7a2ae8d40b
1 changed files with 33 additions and 0 deletions
33
tests/lean/run/ematch1.lean
Normal file
33
tests/lean/run/ematch1.lean
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
constant f : nat → nat
|
||||
constant g : nat → nat
|
||||
axiom Ax : ∀ x, (: f (g x) :) = x
|
||||
|
||||
open tactic
|
||||
|
||||
meta def add_insts : list (expr × expr) → tactic unit
|
||||
| [] := skip
|
||||
| ((inst, pr)::r) := do
|
||||
assertv `_einst inst pr,
|
||||
add_insts r
|
||||
|
||||
meta def ematch_test (h : name) (e : expr) : tactic unit :=
|
||||
do cc ← cc_state.mk_using_hs,
|
||||
ems ← return $ ematch_state.mk 10000,
|
||||
hlemma ← hinst_lemma.mk_from_decl h,
|
||||
(r, cc, ems) ← ematch cc ems hlemma e,
|
||||
add_insts r
|
||||
|
||||
example (a b c : nat) : f a = b → a = g c → f a ≠ c → false :=
|
||||
by do
|
||||
intros,
|
||||
e ← to_expr `(f a),
|
||||
ematch_test `Ax e,
|
||||
trace_state,
|
||||
cc
|
||||
|
||||
example (a b c : nat) : f a = b → a = g c → f a = c :=
|
||||
by do
|
||||
intros,
|
||||
e ← to_expr `(f a),
|
||||
ematch_test `Ax e,
|
||||
cc
|
||||
Loading…
Add table
Reference in a new issue