2014-06-22 16:54:05 +00:00
|
|
|
local env = environment()
|
|
|
|
local N = Const("N")
|
2014-10-02 23:54:56 +00:00
|
|
|
env = add_decl(env, mk_constant_assumption("N", Type))
|
|
|
|
env = add_decl(env, mk_constant_assumption("f", mk_arrow(N, N)))
|
|
|
|
env = add_decl(env, mk_constant_assumption("a", N))
|
2014-06-22 16:54:05 +00:00
|
|
|
local f = Const("f")
|
|
|
|
local a = Const("a")
|
|
|
|
local m1 = mk_metavar("m1", mk_metavar("m2", mk_sort(mk_meta_univ("l"))))
|
|
|
|
local ngen = name_generator("tst")
|
2014-06-26 20:35:36 +00:00
|
|
|
local tc = type_checker(env, ngen)
|
2014-08-20 05:31:26 +00:00
|
|
|
|
|
|
|
function test_check(e)
|
|
|
|
t, cs = tc:check(e)
|
|
|
|
print(tostring(e) .. " : " .. tostring(t))
|
|
|
|
cs = cs:linearize()
|
|
|
|
for i = 1, #cs do
|
|
|
|
print(" >> " .. tostring(cs[i]))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
test_check(f(m1))
|
|
|
|
test_check(f(f(m1)))
|
|
|
|
test_check(f(m1))
|