2014-07-22 16:43:18 +00:00
|
|
|
local m = mk_metavar("m", Prop)
|
2014-05-01 22:30:30 +00:00
|
|
|
local s = substitution()
|
|
|
|
assert(not s:is_assigned(m))
|
|
|
|
assert(not s:is_expr_assigned("m"))
|
|
|
|
assert(not s:is_level_assigned("m"))
|
|
|
|
local f = Const("f")
|
|
|
|
local g = Const("g")
|
|
|
|
local a = Const("a")
|
|
|
|
local t = f(f(a))
|
2014-07-23 15:51:24 +00:00
|
|
|
s:assign(m, t)
|
2014-05-01 22:30:30 +00:00
|
|
|
assert(s:is_assigned(m))
|
|
|
|
assert(s:is_expr_assigned("m"))
|
|
|
|
assert(not s:is_level_assigned("m"))
|
|
|
|
assert(s:instantiate(g(m)) == g(t))
|
2014-07-23 15:51:24 +00:00
|
|
|
s:assign("m", a)
|
2014-05-01 22:30:30 +00:00
|
|
|
assert(s:instantiate(g(m)) == g(a))
|
|
|
|
local l = mk_level_one()
|
|
|
|
local u = mk_meta_univ("u")
|
2014-07-23 15:51:24 +00:00
|
|
|
s:assign(u, l)
|
2014-05-01 22:30:30 +00:00
|
|
|
assert(s:is_assigned(u))
|
|
|
|
assert(s:is_level_assigned("u"))
|
|
|
|
assert(not s:is_expr_assigned("u"))
|
2014-07-22 16:43:18 +00:00
|
|
|
local m2 = mk_metavar("m2", Prop)
|
2014-07-23 15:51:24 +00:00
|
|
|
s:assign(m2, f(m))
|
2014-10-17 19:55:45 +00:00
|
|
|
assert(s:is_expr_assigned("m"))
|
|
|
|
-- m is assigned, so it is does not occur in f(m2)
|
|
|
|
-- assert(s:occurs_expr("m", f(m2)))
|
2014-05-01 22:30:30 +00:00
|
|
|
print(s:instantiate(mk_sort(u)))
|
|
|
|
assert(s:instantiate(mk_sort(u)) == mk_sort(l))
|
2014-10-17 19:55:45 +00:00
|
|
|
local s = substitution()
|
|
|
|
local m2 = mk_metavar("m2", Prop)
|
|
|
|
s:assign(m2, f(m))
|
|
|
|
assert(not s:is_expr_assigned("m"))
|
|
|
|
assert(s:occurs_expr("m", f(m2)))
|