2014-05-21 18:24:24 +00:00
|
|
|
local env = bare_environment()
|
2014-07-22 16:43:18 +00:00
|
|
|
env = add_decl(env, mk_var_decl("f", mk_arrow(Prop, mk_arrow(Prop, Prop))))
|
2014-05-13 00:49:51 +00:00
|
|
|
local f = Const("f")
|
2014-07-22 16:43:18 +00:00
|
|
|
local x = Local("x", Prop)
|
|
|
|
local y = Local("y", Prop)
|
|
|
|
local z = Local("z", Prop)
|
2014-05-13 00:49:51 +00:00
|
|
|
local tc = type_checker(env)
|
2014-06-30 16:14:55 +00:00
|
|
|
print(tc:whnf(Fun(x, f(x))))
|
|
|
|
print(tc:whnf(Fun(x, y, f(x, y))))
|
|
|
|
print(tc:whnf(Fun(x, y, f(Const("a"), y))))
|
|
|
|
print(tc:whnf(Fun(z, x, y, f(z, y))))
|
|
|
|
assert(tc:is_def_eq(f, Fun(x, f(x))))
|
|
|
|
assert(tc:is_def_eq(f, Fun(x, y, f(x, y))))
|
2014-05-13 00:49:51 +00:00
|
|
|
local A = Const("A")
|
2014-06-30 16:14:55 +00:00
|
|
|
local a = Local("a", A)
|
|
|
|
assert(tc:is_def_eq(Fun(a, a)(f), Fun(x, y, f(x, y))))
|