2014-06-27 03:43:49 +00:00
|
|
|
local env = environment()
|
|
|
|
local N = Const("N")
|
|
|
|
local P = Const("P")
|
2014-10-02 23:54:56 +00:00
|
|
|
env = add_decl(env, mk_constant_assumption("N", Type))
|
|
|
|
env = add_decl(env, mk_constant_assumption("P", mk_arrow(N, Prop)))
|
2014-06-27 03:43:49 +00:00
|
|
|
local a = Local("a", N)
|
|
|
|
local H = Local("H", P(a))
|
2014-07-22 16:43:18 +00:00
|
|
|
local t = Pi(H, Prop)
|
2014-06-27 03:43:49 +00:00
|
|
|
print(env:infer_type(t))
|
|
|
|
local m = mk_metavar("m", mk_arrow(N, N, Type))
|
|
|
|
local cs = { mk_eq_cnstr(m(a, a), t) }
|
|
|
|
|
2014-07-05 16:43:16 +00:00
|
|
|
ss = unify(env, cs, name_generator())
|
2014-06-27 03:43:49 +00:00
|
|
|
local n = 0
|
|
|
|
for s in ss do
|
|
|
|
print("solution: " .. tostring(s:instantiate(m)))
|
|
|
|
s:for_each_expr(function(n, v, j)
|
|
|
|
print(" " .. tostring(n) .. " := " .. tostring(v))
|
|
|
|
end)
|
|
|
|
s:for_each_level(function(n, v, j)
|
|
|
|
print(" " .. tostring(n) .. " := " .. tostring(v))
|
|
|
|
end)
|
|
|
|
n = n + 1
|
|
|
|
end
|
|
|
|
assert(n == 2)
|