lean2/tests/lean/simp31.lean
Leonardo de Moura 8bccfb947a feat(library/simplifier): expose simplier and simplifier_monitor objects in the Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-27 15:02:05 -08:00

29 lines
1 KiB
Text

rewrite_set simple
add_rewrite Nat::add_comm Nat::add_left_comm Nat::add_assoc Nat::add_zeror : simple
variables a b c : Nat
(*
function indent(s)
for i = 1, s:depth()-1 do
io.write(" ")
end
end
local m = simplifier_monitor(function(s, e)
print("Visit, depth: " .. s:depth() .. ", " .. tostring(e))
end,
function(s, e, new_e, pr)
print("Step: " .. tostring(e) .. " ===> " .. tostring(new_e))
end,
function(s, e, new_e, ceq, ceq_id)
print("Rewrite using: " .. tostring(ceq_id))
print(" " .. tostring(e) .. " ===> " .. tostring(new_e))
end
)
local s = simplifier("simple", options(), m)
local t = parse_lean('a + (b + 0) + a')
print(t)
print("=====>")
local t2, pr = s(t)
print(t2)
print(pr)
get_environment():type_check(pr)
*)