2014-01-05 20:05:08 +00:00
|
|
|
import Int.
|
2014-01-05 18:32:47 +00:00
|
|
|
(*
|
2013-11-14 04:59:28 +00:00
|
|
|
|
|
|
|
local env = get_environment()
|
|
|
|
local o1 = env:find_object(name("Int", "add"))
|
|
|
|
print(o1:get_value())
|
|
|
|
assert(is_kernel_object(o1))
|
2013-12-08 22:37:38 +00:00
|
|
|
assert(o1)
|
2013-11-14 04:59:28 +00:00
|
|
|
assert(o1:is_builtin())
|
2014-01-05 20:05:08 +00:00
|
|
|
assert(o1:keyword() == "builtin")
|
2013-11-14 04:59:28 +00:00
|
|
|
assert(o1:get_name() == name("Int", "add"))
|
2013-12-08 22:37:38 +00:00
|
|
|
local o2 = env:find_object("xyz31213")
|
|
|
|
assert(not o2)
|
2013-11-14 04:59:28 +00:00
|
|
|
|
|
|
|
local found1 = false
|
|
|
|
local found2 = false
|
|
|
|
local bs = nil
|
|
|
|
for obj in env:objects() do
|
|
|
|
if not obj:has_name() then
|
|
|
|
found1 = true
|
|
|
|
end
|
|
|
|
if obj:is_builtin_set() then
|
|
|
|
if not found2 then
|
|
|
|
found2 = true
|
|
|
|
bs = obj
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
assert(found1)
|
|
|
|
assert(found2)
|
|
|
|
print(bs)
|
|
|
|
assert(not bs:in_builtin_set(Const("a")))
|
|
|
|
|
|
|
|
assert(not pcall(function() o1:get_cnstr_level() end))
|
|
|
|
env:add_var("x", Const("Int"))
|
|
|
|
env:add_definition("val", Const("Int"), Const("x"))
|
|
|
|
assert(env:find_object("val"):get_value() == Const("x"))
|
|
|
|
assert(env:find_object("val"):get_weight() == 1)
|
2014-01-06 03:10:21 +00:00
|
|
|
assert(env:find_object("congr"):is_opaque())
|
|
|
|
assert(env:find_object("congr"):is_theorem())
|
|
|
|
assert(env:find_object("refl"):is_axiom())
|
2013-11-14 04:59:28 +00:00
|
|
|
assert(env:find_object(name("Int", "sub")):is_definition())
|
|
|
|
assert(env:find_object("x"):is_var_decl())
|
2014-01-05 18:32:47 +00:00
|
|
|
*)
|