lean2/tests/lua/ind5.lua
Leonardo de Moura 6246fae32c fix(kernel/inductive): inductive datatype declaration validation bug pointed out by Cody Roux
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-21 16:29:25 -07:00

23 lines
658 B
Lua

function display_type(env, t)
print(tostring(t) .. " : " .. tostring(env:normalize(env:type_check(t))))
end
local A = Local("A", Bool)
local env = environment()
local retraction = Const("retraction")
env = add_inductive(env,
"retraction", Bool,
"inj", Pi(A, retraction))
local u = global_univ("u")
env = env:add_global_level("u")
local a = Local("a", Bool)
local r = Local("r", retraction)
local rec = Const("retraction_rec")
display_type(env, rec)
local proj = Fun(r, rec(Bool, Fun(a, a), r))
local inj = Const("inj")
assert(not pcall(function() display_type(env, Fun(a, proj(inj(a)))) end))