test(lua): add replace method test
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
9f86aa73c8
commit
20947de2f1
1 changed files with 21 additions and 0 deletions
21
tests/lua/env6.lua
Normal file
21
tests/lua/env6.lua
Normal file
|
@ -0,0 +1,21 @@
|
|||
local env = empty_environment()
|
||||
env = add_decl(env, mk_var_decl("A", Bool))
|
||||
local A = Const("A")
|
||||
local x = Const("x")
|
||||
env = add_decl(env, mk_axiom("magic", Pi(x, Bool, x)))
|
||||
local saved_env = env
|
||||
env = add_decl(env, mk_axiom("Ax", A))
|
||||
env = add_decl(env, mk_definition("T1", A, Const("Ax")))
|
||||
-- The check mk_theorem("Ax", A, Const("T1")) failes because env
|
||||
-- contains the axiom named Ax.
|
||||
-- So, we cannot transform Ax into a theorem that depends on itself.
|
||||
-- (This is good)
|
||||
assert(not pcall(function() env:replace(check(env, mk_theorem("Ax", A, Const("T1")))) end))
|
||||
assert(env:find("Ax"):is_axiom())
|
||||
local magic = Const("magic")
|
||||
-- Replace axiom Ax with the theorem Ax that is checked in the old
|
||||
-- environment saved_env. Everything works because env is a descendant
|
||||
-- of saved_env
|
||||
env = env:replace(check(saved_env, mk_theorem("Ax", A, magic(A))))
|
||||
assert(not env:find("Ax"):is_axiom())
|
||||
assert(env:find("Ax"):is_theorem())
|
Loading…
Reference in a new issue