lean2/tests/lean/lua9.lean
Leonardo de Moura 4ba097a141 feat(frontends/lean): use lowercase commands, replace 'endscope' and 'endnamespace' with 'end'
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-05 13:06:36 -08:00

38 lines
750 B
Text

import Int.
variable x : Bool
(*
import("util.lua")
local env = get_environment()
local Int = Const("Int")
local plus = Const{"Int", "add"}
local x1, x2 = Consts("x1, x2")
print(env:type_check(Int))
print(env:type_check(plus))
env:add_var("x1", Int)
env:add_var("x2", Int)
print(plus(x1, x2))
print(env:type_check(plus(x1)))
function sum(...)
local args = {...}
if #args == 0 then
error("sum must have at least one argument")
else
local r = args[1]
for i = 2, #args do
r = plus(r, args[i])
end
return r
end
end
local s = sum(x1, x1, x1, x2, x2)
print(s)
print(env:type_check(s))
env:add_definition("sum1", s)
*)
print environment 1
eval sum1
variable y : Bool