lean2/tests/lua/level1.lua
2014-05-11 18:05:02 -07:00

33 lines
1.9 KiB
Lua

assert(level():is_zero())
assert(mk_level_zero():is_zero())
assert(mk_level_one():is_succ())
assert(not mk_level_one():is_zero())
assert(mk_level_max(mk_level_zero(), mk_level_one()):is_succ())
assert(mk_level_max(mk_param_univ("a"), mk_param_univ("b")):is_max())
assert(mk_level_max(mk_level_one(), mk_level_zero()):is_succ())
assert(level():succ():is_succ())
assert(mk_level_imax(mk_level_one(), mk_level_zero()):is_zero())
assert(is_level(mk_level_one()))
assert(not is_level(1))
assert(mk_level_one():succ_of() == mk_level_zero())
assert(mk_level_one():succ_of():is_zero())
assert(mk_level_succ(mk_level_succ(level())):is_not_zero())
assert(not mk_param_univ("a"):is_not_zero())
assert(mk_level_max(mk_param_univ("a"), mk_param_univ("b")):lhs() == mk_param_univ("a"))
assert(mk_level_max(mk_param_univ("a"), mk_param_univ("b")):rhs() == mk_param_univ("b"))
assert(mk_level_imax(mk_param_univ("a"), mk_param_univ("b")):lhs() == mk_param_univ("a"))
assert(mk_level_imax(mk_param_univ("a"), mk_param_univ("b")):rhs() == mk_param_univ("b"))
assert(mk_param_univ("a"):id() == name("a"))
assert(mk_meta_univ("b"):id() == name("b"))
assert(mk_level_succ(mk_level_zero()):is_equivalent(mk_level_one()))
assert(not mk_param_univ("b"):is_equivalent(mk_param_univ("a")))
assert(mk_level_one():kind() == level_kind.Succ)
assert(not mk_level_one():has_meta())
assert(not mk_level_succ(mk_param_univ("a")):has_meta())
assert(mk_level_succ(mk_meta_univ("a")):has_meta())
local l = mk_level_max(mk_param_univ("a"), mk_param_univ("b"))
assert(l:instantiate({"a"}, {mk_level_one()}) == mk_level_max(mk_level_one(), mk_param_univ("b")))
assert(l:instantiate({"a", "b"}, {mk_level_one(), mk_param_univ("c")}) == mk_level_max(mk_level_one(), mk_param_univ("c")))
assert(not pcall(function() l:instantiate({"a", "b", "C"}, {mk_level_one(), mk_param_univ("c")}) end))
assert(l:is_eqp(l))
assert(not l:is_eqp(level()))