2014-05-21 18:24:24 +00:00
|
|
|
local env = bare_environment()
|
2014-05-08 02:03:46 +00:00
|
|
|
local g = name_generator("tst")
|
|
|
|
local tc = type_checker(env, g)
|
|
|
|
assert(is_type_checker(tc))
|
2014-07-22 16:43:18 +00:00
|
|
|
local a = Local("a", Prop)
|
2014-06-30 16:14:55 +00:00
|
|
|
local t = Fun(a, a)
|
2014-05-08 02:03:46 +00:00
|
|
|
local b = Const("b")
|
|
|
|
print(t(b))
|
|
|
|
assert(tc:whnf(t(b)) == b)
|
2014-07-22 16:43:18 +00:00
|
|
|
assert(tc:check(Prop) == mk_sort(mk_level_one()))
|
2014-05-08 02:03:46 +00:00
|
|
|
print(tc:infer(t))
|
|
|
|
local m = mk_metavar("m1", mk_metavar("m2", mk_sort(mk_meta_univ("u"))))
|
|
|
|
print(tc:infer(m))
|
2014-06-22 16:00:04 +00:00
|
|
|
|
2014-06-26 20:35:36 +00:00
|
|
|
local tc2 = type_checker(env, g)
|
2014-06-30 16:14:55 +00:00
|
|
|
local t2 = Fun(a, m(a))
|
2014-06-22 16:00:04 +00:00
|
|
|
print("---------")
|
|
|
|
print("t2: ")
|
2014-05-08 02:03:46 +00:00
|
|
|
print(t2)
|
2014-06-22 16:00:04 +00:00
|
|
|
print("check(t): ")
|
2014-05-08 02:03:46 +00:00
|
|
|
print(tc2:check(t))
|
2014-06-22 16:00:04 +00:00
|
|
|
print("check(t2): ")
|
2014-05-08 02:03:46 +00:00
|
|
|
print(tc2:check(t2))
|