2014-06-20 16:46:13 +00:00
|
|
|
local env = environment()
|
2014-10-02 23:54:56 +00:00
|
|
|
env = add_decl(env, mk_constant_assumption("N", Type))
|
2014-06-20 16:46:13 +00:00
|
|
|
local N = Const("N")
|
2014-10-02 23:54:56 +00:00
|
|
|
env = add_decl(env, mk_constant_assumption("f", mk_arrow(N, N)))
|
|
|
|
env = add_decl(env, mk_constant_assumption("g", mk_arrow(N, N)))
|
|
|
|
env = add_decl(env, mk_constant_assumption("a", N))
|
2014-06-20 16:46:13 +00:00
|
|
|
local f = Const("f")
|
|
|
|
local g = Const("g")
|
|
|
|
local x = Local("x", N)
|
|
|
|
env = add_decl(env, mk_definition("h", mk_arrow(N, N), Fun(x, f(x)), {opaque=false}))
|
|
|
|
local h = Const("h")
|
|
|
|
local a = Const("a")
|
|
|
|
local m1 = mk_metavar("m1", N)
|
|
|
|
local ngen = name_generator("tst")
|
2014-06-26 20:35:36 +00:00
|
|
|
local tc = type_checker(env, ngen)
|
2014-06-24 16:00:14 +00:00
|
|
|
assert(not tc:is_def_eq(f(m1), g(a)))
|
|
|
|
assert(not tc:is_def_eq(f(m1), a))
|
2014-06-20 16:46:13 +00:00
|
|
|
assert(not tc:is_def_eq(f(a), a))
|
2014-06-24 16:00:14 +00:00
|
|
|
assert(not tc:is_def_eq(mk_lambda("x", N, Var(0)), h(m1)))
|
2014-06-20 16:46:13 +00:00
|
|
|
assert(tc:is_def_eq(h(a), f(a)))
|
|
|
|
assert(tc:is_def_eq(h(a), f(m1)))
|