2014-05-23 11:26:02 -07:00
|
|
|
local env = environment()
|
|
|
|
local l = param_univ("l")
|
|
|
|
local U_l = mk_sort(l)
|
|
|
|
local A = Local("A", U_l)
|
2014-07-22 09:43:18 -07:00
|
|
|
local R = Local("R", mk_arrow(A, A, Prop))
|
2014-05-23 11:26:02 -07:00
|
|
|
local Acc = Const("Acc", {l})
|
|
|
|
local x = Local("x", A)
|
|
|
|
local y = Local("y", A)
|
|
|
|
env = add_inductive(env,
|
2014-07-22 09:43:18 -07:00
|
|
|
"Acc", {l}, 2, Pi(A, R, x, Prop),
|
2014-06-30 09:14:55 -07: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 11:26:02 -07:00
|
|
|
|
|
|
|
function display_type(env, t)
|
|
|
|
print(tostring(t) .. " : " .. tostring(type_checker(env):infer(t)))
|
|
|
|
end
|
|
|
|
|
2014-11-06 09:36:54 -08:00
|
|
|
display_type(env, Const({"Acc", "rec"}, {0, 1}))
|