test(library/simplifier): add test for the single_pass option in the simplifier

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-01-21 13:47:54 -08:00
parent ead54bbf57
commit 331b5846c6
2 changed files with 39 additions and 0 deletions

18
tests/lean/simp12.lean Normal file
View file

@ -0,0 +1,18 @@
variables a b c d e f : Nat
rewrite_set simple
add_rewrite Nat::add_assoc Nat::add_comm Nat::add_left_comm Nat::distributer Nat::distributel : simple
(*
local opts = options({"simplifier", "single_pass"}, true)
local t = parse_lean("f + (c + f + d) + (e * (a + c) + (d + a))")
print(t)
for i = 1, 10 do
local t2, pr = simplify(t, "simple", get_environment(), context(), opts)
print("i: " .. i .. " ====>")
print(t2)
if t == t2 then
break
end
t = t2
end
*)

View file

@ -0,0 +1,21 @@
Set: pp::colors
Set: pp::unicode
Assumed: a
Assumed: b
Assumed: c
Assumed: d
Assumed: e
Assumed: f
f + (c + f + d) + (e * (a + c) + (d + a))
i: 1 ====>
d + (f + (c + f) + (a + d + (e * a + e * c)))
i: 2 ====>
a + (d + (c + (f + f) + (d + (e * a + e * c))))
i: 3 ====>
a + (d + (d + (c + (f + f) + (e * a + e * c))))
i: 4 ====>
a + (c + (d + (d + (f + f + (e * a + e * c)))))
i: 5 ====>
a + (c + (d + (d + (f + (f + (e * a + e * c))))))
i: 6 ====>
a + (c + (d + (d + (f + (f + (e * a + e * c))))))