lean2/tests/lua/goal1.lua
Leonardo de Moura feeb6d9105 feat(bindings/lua): add goal object to Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-25 20:51:47 -08:00

31 lines
829 B
Lua

local hs = hypotheses()
assert(is_hypotheses(hs))
assert(hs:empty())
assert(hs:is_nil())
local hs = hypotheses("H1", Const("q"), hs)
local hs = hypotheses("H2", Const("p"), hs)
local n, p = hs:head()
assert(n == name("H2"))
assert(p == Const("p"))
assert(not hs:empty())
assert(hs:tail():tail():empty())
for n, p in hs:pairs() do
print(n, p)
end
assert(not pcall(function() hypotheses("H1", Const("q"), "H2", Const("p"), hs) end))
assert(#hs == 2)
assert(hs:size() == 2)
local g = goal(hs, Const("p1"))
assert(is_goal(g))
print(g)
assert(#(g:hypotheses()) == 2)
assert(g:conclusion() == Const("p1"))
assert(not g:is_null())
assert(g:unique_name("H") == name("H"))
assert(g:unique_name("H1") == name("H1", 1))
print(g:pp())
local opts = options()
opts = opts:update(name("pp", "unicode"), false)
print(opts)
print(g:pp(opts))