2013-12-01 18:27:27 +00:00
|
|
|
local env = environment()
|
2014-01-01 21:52:25 +00:00
|
|
|
env:import("Int")
|
refactor(kernel): add unfold_opaque flag to normalizer, modify how type checker uses the opaque flag, remove hidden_defs, and mark most builtin definitions as opaque
After this commit, in the type checker, when checking convertability, we first compute a normal form without expanding opaque terms.
If the terms are convertible, then we are done, and saved a lot of time by not expanding unnecessary definitions.
If they are not, instead of throwing an error, we try again expanding the opaque terms.
This seems to be the best of both worlds.
The opaque flag is a hint for the type checker, but it would never prevent us from type checking a valid term.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-20 20:47:36 +00:00
|
|
|
assert(env:is_opaque("and"))
|
|
|
|
assert(env:is_opaque("or"))
|
|
|
|
assert(env:is_opaque({"Int", "lt"}))
|
2013-12-01 18:27:27 +00:00
|
|
|
parse_lean_cmds([[
|
|
|
|
Definition a : Bool := true
|
|
|
|
]], env)
|
refactor(kernel): add unfold_opaque flag to normalizer, modify how type checker uses the opaque flag, remove hidden_defs, and mark most builtin definitions as opaque
After this commit, in the type checker, when checking convertability, we first compute a normal form without expanding opaque terms.
If the terms are convertible, then we are done, and saved a lot of time by not expanding unnecessary definitions.
If they are not, instead of throwing an error, we try again expanding the opaque terms.
This seems to be the best of both worlds.
The opaque flag is a hint for the type checker, but it would never prevent us from type checking a valid term.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-20 20:47:36 +00:00
|
|
|
assert(not env:is_opaque("a"))
|
|
|
|
env:set_opaque("a", true)
|
|
|
|
assert(env:is_opaque("a"))
|
|
|
|
env:set_opaque("a", false)
|
|
|
|
assert(not env:is_opaque("a"))
|
|
|
|
assert(not env:is_opaque("b"))
|