2014-05-23 18:26:02 +00:00
|
|
|
local env = environment()
|
|
|
|
local l = param_univ("l")
|
|
|
|
local U_l = mk_sort(l)
|
|
|
|
local A = Local("A", U_l)
|
2014-07-22 16:43:18 +00:00
|
|
|
local R = Local("R", mk_arrow(A, A, Prop))
|
2014-05-23 18:26:02 +00:00
|
|
|
local Acc = Const("Acc", {l})
|
|
|
|
local x = Local("x", A)
|
|
|
|
local y = Local("y", A)
|
|
|
|
env = add_inductive(env,
|
2014-07-22 16:43:18 +00:00
|
|
|
"Acc", {l}, 2, Pi(A, R, x, Prop),
|
2014-06-30 16:14:55 +00:00
|
|
|
"Acc_intro", Pi(A, R, x, mk_arrow(Pi(y, mk_arrow(R(y, x), Acc(A, R, y))), Acc(A, R, x))))
|
2014-05-23 18:26:02 +00:00
|
|
|
|
|
|
|
function display_type(env, t)
|
|
|
|
print(tostring(t) .. " : " .. tostring(type_checker(env):infer(t)))
|
|
|
|
end
|
|
|
|
|
2014-09-04 22:03:59 +00:00
|
|
|
display_type(env, Const({"Acc", "rec"}, {1}))
|