2014-01-15 02:22:33 +00:00
|
|
|
local env = get_environment()
|
2014-01-15 23:30:16 +00:00
|
|
|
assert(env:find_object("neq_elim"))
|
2014-01-15 02:22:33 +00:00
|
|
|
|
|
|
|
function show_ceqs(ceqs)
|
|
|
|
for i = 1, #ceqs do
|
2014-01-16 03:53:52 +00:00
|
|
|
print(ceqs[i][1], ceqs[i][2], is_permutation_ceq(ceqs[i][1]))
|
2014-01-15 02:22:33 +00:00
|
|
|
env:type_check(ceqs[i][2])
|
2014-01-15 20:05:14 +00:00
|
|
|
assert(is_ceq(env, ceqs[i][1]))
|
2014-01-15 02:22:33 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-01-16 03:53:52 +00:00
|
|
|
function test_ceq(name, expected, is_perm)
|
2014-01-15 02:22:33 +00:00
|
|
|
local obj = env:find_object(name)
|
|
|
|
local r = to_ceqs(env, obj:get_type(), Const(name))
|
|
|
|
show_ceqs(r)
|
|
|
|
assert(#r == expected)
|
2014-01-16 03:53:52 +00:00
|
|
|
if is_perm ~= nil then
|
|
|
|
for i = 1, #r do
|
|
|
|
assert(is_permutation_ceq(r[i][1]) == is_perm)
|
|
|
|
end
|
|
|
|
end
|
2014-01-15 02:22:33 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
parse_lean_cmds([[
|
|
|
|
import if_then_else
|
|
|
|
variable f : Nat -> Nat
|
|
|
|
axiom Ax1 : forall x : Nat, x > 0 -> f x < 0 /\ not (f x = 1)
|
|
|
|
axiom Ax2 : forall x : Nat, x < 0 -> f (f x) = x
|
|
|
|
variable g : Nat -> Nat -> Nat
|
|
|
|
axiom Ax3 : forall x : Nat, not (x = 1) -> if (x < 0) then (g x x = 0) else (g x x < 0 /\ g x 0 = 1 /\ g 0 x = 2)
|
2014-01-15 20:05:14 +00:00
|
|
|
axiom Ax4 : forall x y : Nat, f x = x
|
|
|
|
axiom Ax5 : forall x y : Nat, f x = y /\ g x y = x
|
2014-01-15 23:30:16 +00:00
|
|
|
axiom Ax6 : forall x : Nat, f x ≠ 0
|
2014-01-15 02:22:33 +00:00
|
|
|
]])
|
|
|
|
|
|
|
|
test_ceq("Ax1", 2)
|
|
|
|
test_ceq("Ax2", 1)
|
|
|
|
test_ceq("Ax3", 4)
|
2014-01-15 20:05:14 +00:00
|
|
|
test_ceq("Ax4", 0)
|
|
|
|
test_ceq("Ax5", 1)
|
2014-01-15 23:30:16 +00:00
|
|
|
test_ceq("Ax6", 1)
|
2014-01-16 00:05:57 +00:00
|
|
|
test_ceq("eta", 1)
|
2014-01-16 03:53:52 +00:00
|
|
|
test_ceq("not_not_eq", 1, false)
|
|
|
|
test_ceq("or_comm", 1, true)
|
|
|
|
test_ceq("or_assoc", 1, false)
|
|
|
|
test_ceq("or_id", 1, false)
|
|
|
|
test_ceq("or_falsel", 1, false)
|
|
|
|
test_ceq("or_falser", 1, false)
|
|
|
|
test_ceq("or_truel", 1, false)
|
|
|
|
test_ceq("or_truer", 1, false)
|
|
|
|
test_ceq("or_tauto", 1, false)
|
|
|
|
test_ceq("and_comm", 1, true)
|
|
|
|
test_ceq("and_assoc", 1, false)
|
|
|
|
test_ceq("and_id", 1, false)
|
|
|
|
test_ceq("and_falsel", 1, false)
|
|
|
|
test_ceq("and_falser", 1, false)
|
|
|
|
test_ceq("and_truel", 1, false)
|
|
|
|
test_ceq("and_truer", 1, false)
|
|
|
|
test_ceq("and_absurd", 1, false)
|
|
|
|
test_ceq("imp_truer", 1, false)
|
|
|
|
test_ceq("imp_truel", 1, false)
|
|
|
|
test_ceq("imp_falser", 1, false)
|
|
|
|
test_ceq("imp_falsel", 1, false)
|
|
|
|
test_ceq("not_and", 1, false)
|
|
|
|
test_ceq("not_or", 1, false)
|
|
|
|
test_ceq("not_iff", 1, false)
|
|
|
|
test_ceq("not_implies", 1, false)
|
|
|
|
test_ceq("or_left_comm", 1, true)
|
|
|
|
test_ceq("and_left_comm", 1, true)
|
|
|
|
test_ceq("forall_or_distributer", 1, false)
|
|
|
|
test_ceq("forall_or_distributel", 1, false)
|
|
|
|
test_ceq("forall_and_distribute", 1, false)
|
|
|
|
test_ceq("exists_and_distributer", 1, false)
|
|
|
|
test_ceq("exists_and_distributel", 1, false)
|
|
|
|
test_ceq("exists_or_distribute", 1, false)
|
|
|
|
test_ceq({"Nat", "add_zeror"}, 1, false)
|
|
|
|
test_ceq({"Nat", "add_zerol"}, 1, false)
|
|
|
|
test_ceq({"Nat", "add_comm"}, 1 , true)
|
|
|
|
test_ceq({"Nat", "add_assoc"}, 1, false)
|
|
|
|
test_ceq({"Nat", "mul_zerol"}, 1, false)
|
|
|
|
test_ceq({"Nat", "mul_zeror"}, 1, false)
|
|
|
|
test_ceq({"Nat", "mul_onel"}, 1, false)
|
|
|
|
test_ceq({"Nat", "mul_oner"}, 1, false)
|
|
|
|
test_ceq({"Nat", "mul_comm"}, 1, true)
|
|
|
|
test_ceq({"Nat", "mul_assoc"}, 1, false)
|
|
|
|
test_ceq({"Nat", "add_comm"}, 1, true)
|
|
|
|
test_ceq({"Nat", "add_assoc"}, 1, false)
|
|
|
|
test_ceq({"Nat", "distributer"}, 1, false)
|
|
|
|
test_ceq({"Nat", "distributel"}, 1, false)
|
|
|
|
test_ceq({"Nat", "le_refl"}, 1, false)
|
|
|
|
test_ceq({"Nat", "le_zero"}, 1, false)
|
|
|
|
test_ceq({"Nat", "not_lt_0"}, 1, false)
|
|
|
|
test_ceq({"Nat", "lt_nrefl"}, 1, false)
|