Commit graph

286 commits

Author SHA1 Message Date
Leonardo de Moura
44a31dd8fb feat(frontends/lean/parser): improve Import command
- The extension does not have to be provided.
- It can also import Lua files.
- Hierachical names can be used instead of strings.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-28 12:05:01 -08:00
Leonardo de Moura
755e8b735f feat(kernel/expr): serializer for kernel expressions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-28 01:23:21 -08:00
Leonardo de Moura
8cf65f354b fix(frontends/lean/pp): forall and exists pretty printing when used as constants
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-27 12:50:41 -08:00
Leonardo de Moura
a02c6e70fa fix(frontends/lean/pp): missing parenthesis around nested forall/exists
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-27 12:13:36 -08:00
Leonardo de Moura
3f0279b88c refactor(frontends/lua): replace lean.lua.h with util.lua
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-26 19:49:26 -08:00
Leonardo de Moura
a9ee92aa3f fix(frontends/lean/parser): macro precedence
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-26 19:17:43 -08:00
Leonardo de Moura
3abfad7a88 feat(frontends/lean/parser): add support for integer arguments in macros
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-26 18:51:37 -08:00
Leonardo de Moura
f1b97b18b4 refactor(frontends/lean/parser): tactic macros, and tactic Lua bindings
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-26 15:54:53 -08:00
Leonardo de Moura
ef18cc4a92 fix(frontends/lean/parser): add existing command macros when creating parser object
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-26 13:38:14 -08:00
Leonardo de Moura
8e4560a866 feat(frontends/lean/parser): protect imported modules from Lua definitions and macros in the file importing the module
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-26 13:21:36 -08:00
Leonardo de Moura
ba02132a90 feat(frontends/lean/parser): add command macros
The idea is to allow users to define their own commands using Lua.
The builtin command Find is now written in Lua.
This commit also fixes a bug in the get_formatter() Lua API.
It also adds String arguments to macros.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-26 13:00:28 -08:00
Leonardo de Moura
480781d13e feat(frontends/lean/parser): provide environment as an argument to macros, allow macros to parse tactics
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-26 11:15:45 -08:00
Leonardo de Moura
3673f2ac1d feat(frontends/lean/parser): add Find command
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-25 18:31:52 -08:00
Leonardo de Moura
a3dde29f3c feat(frontends/lua/parser): allow users to specify the precedence of macros
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-25 12:27:56 -08:00
Leonardo de Moura
f418491c70 fix(frontends/lua/parser): typo
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-25 12:03:04 -08:00
Leonardo de Moura
8e45064f25 feat(library/tactic/apply_tactic): improved parametric apply_tactic
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-24 22:40:34 -08:00
Leonardo de Moura
75cf751959 feat(library/tactic/apply_tactic): allow apply_tac Lua binding to take expressions as argument
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-24 16:03:16 -08:00
Leonardo de Moura
879ab6924a tests(test/lean): remove 'Importing...' message, the tests using the Import command fail when running on a different machine
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-24 12:26:53 -08:00
Soonho Kong
de018220e1 feat(*): use std::make_shared to create shared_ptr 2013-12-24 14:32:50 -05:00
Leonardo de Moura
00e89190c2 refactor(library/cast): use .lean file instead of .cpp file to define casting library
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-23 22:04:19 -08:00
Leonardo de Moura
d5dc5cb576 feat(frontends/lean/parser): use LEAN_PATH in the Import command
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-23 22:00:44 -08:00
Leonardo de Moura
8c8cefcb0c feat(frontends/lean/parser): compact definitions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-23 21:24:50 -08:00
Leonardo de Moura
5043cc75f6 fix(frontends/lean/parser): allow parenthesis in level expressions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-23 13:31:55 -08:00
Leonardo de Moura
5244ccafe8 fix(frontends/lean/parser): readline compilation problem on Fedora19
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-23 13:12:39 -08:00
Leonardo de Moura
7c05eb4695 fix(frontends/lean/parser): make sure Lean passes all tests when being compiled with the readline library
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-23 12:57:25 -08:00
Leonardo de Moura
f0833b6f46 chore(frontends/lua/lean.lua.h): fix style warnings
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-22 21:34:20 -08:00
Leonardo de Moura
e91fdaed00 refactor(frontends/lean): rename lean.lua to lean.lua.h
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-22 20:16:31 -08:00
Leonardo de Moura
baf99779dc feat(frontends/lean/frontend_elaborator): use is_convertible to minimize number of coercions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-22 17:57:51 -08:00
Leonardo de Moura
3e32d9bef2 feat(library/tactic): add support for Pi's at to_proof_state
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-22 16:40:55 -08:00
Leonardo de Moura
21d244d880 feat(frontends/lean/parser): allow tactic to be used to fill holes in definitions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-22 12:08:25 -08:00
Leonardo de Moura
4229e498d2 refactor(kernel/type_checker): combine type_checker and type_inferer into a single class, and avoid code duplication
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-22 11:51:38 -08:00
Leonardo de Moura
9bac91f5ef fix(frontends/lean): libreadline support
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-21 18:57:15 -08:00
Leonardo de Moura
9128a437b8 refactor(library/cast): replace cast semantic attachment with axioms, add heterogeneous symmetry axiom
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-21 18:23:37 -08:00
Leonardo de Moura
df58eb132e feat(frontends/lean): simplify explicit version names
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-21 17:05:25 -08:00
Leonardo de Moura
ce84fe5d33 feat(frontends/lean): improve error messages when elaborator cannot instantiate all metavariables
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-20 22:00:50 -08:00
Leonardo de Moura
bb81311e0a feat(frontends/lean/parser): include proof state in exception for tactic failure
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-20 17:15:12 -08:00
Leonardo de Moura
7772c16033 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 12:47:47 -08:00
Leonardo de Moura
96ea8b81c8 feat(frontends/lean/parser): change show-expression binder name
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-20 01:30:18 -08:00
Leonardo de Moura
c730dd7872 feat(frontends/lean/parser): propagate position information to expressions created by macro implemented in Lua
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-20 01:07:37 -08:00
Leonardo de Moura
3eb4de6760 fix(frontends/lean/parser): fix deadlock in macro parser
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-19 21:40:00 -08:00
Leonardo de Moura
c77464703f feat(frontends/lean): macro definition using Lua
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-19 19:08:10 -08:00
Leonardo de Moura
d9e692f506 feat(frontends/lean): improve coercion manangement
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-19 15:45:46 -08:00
Leonardo de Moura
f43db96e1f fix(frontends/lean/pp): pretty printer for Type
Add parenthesis around Type when it has a universe.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-19 15:24:45 -08:00
Leonardo de Moura
ae01d3818d fix(frontends/lean/parser): parse_type method
The parser had a nasty ambiguity. For example,
    f Type 1
had two possible interpretations
    (f (Type) (1))
or
    (f (Type 1))

To fix this issue, whenever we want to specify a particular universe, we have to precede 'Type' with a parenthesis.
Examples:
    (Type 1)
    (Type U)
    (Type M + 1)

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-19 15:24:34 -08:00
Leonardo de Moura
d3d24696f4 feat(frontends/lean): hide builtin object in the 'Show Environment' command
The user can still display builtin objects by using

    Show Environment all

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-19 14:00:58 -08:00
Leonardo de Moura
ad3f771b1d feat(frontends/lean): hide 'explicit' version of objects with implicit arguments
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-19 13:12:39 -08:00
Leonardo de Moura
bff5a6bfb2 fix(frontends/lean/pp): make sure pp and parser are using the same precedences
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-19 12:46:14 -08:00
Leonardo de Moura
dd72269b13 feat(frontends/lean): rename command Set to SetOption
It is not nice to have Set as a reserved keyword. See example examples/lean/set.lean

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-18 21:18:48 -08:00
Leonardo de Moura
d7886c4f5f doc(examples/lean): new example
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-18 21:03:16 -08:00
Leonardo de Moura
8cfe5cf9ed fix(frontends/lean/pp): pretty printer was ignoring notation decls in the local scope
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-18 18:00:37 -08:00