lean2/tests/lua/tc1.lua
Leonardo de Moura 16bdc51fc4 refactor(kernel/type_checker): simplify type checker API, and remove add_cnstr_fn
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 13:36:31 -07:00

26 lines
671 B
Lua

local env = bare_environment()
local g = name_generator("tst")
local tc = type_checker(env, g)
assert(is_type_checker(tc))
local a = Const("a")
local t = Fun(a, Bool, a)
local b = Const("b")
print(t(b))
assert(tc:whnf(t(b)) == b)
assert(tc:check(Bool) == mk_sort(mk_level_one()))
print(tc:infer(t))
local m = mk_metavar("m1", mk_metavar("m2", mk_sort(mk_meta_univ("u"))))
print(tc:infer(m))
local tc2 = type_checker(env, g)
local t2 = Fun(a, Bool, m(a))
print("---------")
print("t2: ")
print(t2)
print("check(t): ")
print(tc2:check(t))
print("check(t2): ")
print(tc2:check(t2))
assert(tc2:next_cnstr())
assert(tc2:next_cnstr())
assert(not tc2:next_cnstr())