lean4-htt/tests/lean/run/smt_assert_define.lean
Leonardo de Moura 59f3c9775a feat(frontends/lean/tactic_notation): add support for begin [smt] ... end blocks
TODO: add support for inspecting intermediate states.
2017-01-04 11:13:00 -08:00

33 lines
790 B
Text

open smt_tactic
constant p : nat → nat → Prop
constant f : nat → nat
axiom pf (a : nat) : p (f a) (f a) → p a a
example (a b c : nat) : a = b + 0 → a + c = b + c :=
by using_smt $ do
pr ← tactic.to_expr `(add_zero b),
note `h pr,
trace_state, return ()
example (a b c : nat) : a = b → p (f a) (f b) → p a b :=
by using_smt $ do
t ← tactic.to_expr `(p (f a) (f a)),
assert `h t, -- assert automatically closed the new goal
trace_state,
tactic.trace "-----",
pr ← tactic.to_expr `(pf _ h),
note `h2 pr,
trace_state,
return ()
example (a b c : nat) : a = b + 0 → a + c = b + c :=
begin [smt]
add_fact add_zero b
end
example (a b c : nat) : a = b → p (f a) (f b) → p a b :=
begin [smt]
assert h : p (f a) (f a),
add_fact (pf _ h)
end