Commit graph

264 commits

Author SHA1 Message Date
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
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
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
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
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
Leonardo de Moura
79fa6e4940 feat(frontends/lean): Scopes in the default Lean frontend
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-18 17:40:21 -08:00
Leonardo de Moura
97b872a05c refactor(frontends/lean): remove frontend class, it is not needed anymore
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-18 14:37:55 -08:00
Leonardo de Moura
2aaa9a5273 feat(frontends/lean/parser): change function application precedence
Now, we can write

  Pi (x y : A), R x y -> R y x

instead of

  Pi (x y : A), (R x y) -> (R y x)

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-18 12:44:15 -08:00
Leonardo de Moura
47c7bb1bde refactor(*): uses aliases for unordered_map and unordered_set
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-18 12:30:45 -08:00
Leonardo de Moura
1e4fa76a47 feat(util/name_map): add template alias
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-18 11:34:40 -08:00
Leonardo de Moura
51aee83b70 refactor(kernel/metavar_env): use the same approach used in the class environment in the class metavar_env
This modification was motivated by a bug exposed by tst17 at tests/kernel/type_checker.
metavar_env is now a smart point to metavar_env_cell.
ro_metavar_env is a read-only smart pointer. It is useful to make sure we are using proof_state correctly.

example showing that the approach for caching metavar_env is broken in the type_checker

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-13 18:59:15 -08:00
Leonardo de Moura
f97c260b0b refactor(kernel/environment): add ro_environment
The environment object is a "smart-pointer".
Before this commit, the use of "const &" for environment objects was broken.
For example, suppose we have a function f that should not modify the input environment.
Before this commit, its signature would be
       void f(environment const & env)
This is broken, f's implementation can easilty convert it to a read-write pointer by using
the copy constructor.
       environment rw_env(env);
Now, f can use rw_env to update env.

To fix this issue, we now have ro_environment. It is a shared *const* pointer.
We can convert an environment into a ro_environment, but not the other way around.

ro_environment can also be seen as a form of documentation.
For example, now it is clear that type_inferer is not updating the environment, since its constructor takes a ro_environment.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-12 16:48:34 -08:00
Leonardo de Moura
bbaa83e16a feat(frontends/lean): implement relaxed operator compatibility in the parser
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-10 15:42:43 -08:00
Leonardo de Moura
abe2cf2fb5 feat(frontends/lean): simplify how implicit parameters are marked
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-10 12:11:04 -08:00
Leonardo de Moura
78ec4b152b feat(frontends/lean): relax restricitions on parsing applications of functions containing implicit arguments
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-10 09:48:24 -08:00
Leonardo de Moura
68c2e5cc7d fix(frontends/lean/parser): reachable code
The new test nbug1.lean exposes the problem.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-08 15:22:21 -08:00
Leonardo de Moura
8add5571f1 refactor(library/tactic): remove 'null' tactic, and operator bool tactics
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-08 15:00:16 -08:00
Leonardo de Moura
04b67f8b14 refactor(kernel/object): remove 'null' object, and operator bool for kernel objects
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-08 14:37:38 -08:00
Leonardo de Moura
2f88d6710c feat(kernel/expr): add some_expr and none_expr for building values of type optional<expr>
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-08 10:34:38 -08:00
Leonardo de Moura
3e1fd06903 refactor(kernel/expr): remove 'null' expression, and operator bool for expression
After this commit, a value of type 'expr' cannot be a reference to nullptr.
This commit also fixes several bugs due to the use of 'null' expressions.

TODO: do the same for kernel objects, sexprs, etc.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-07 23:21:10 -08:00
Leonardo de Moura
e4dff52d7a refactor(frontends/lean/parser): cleanup method apply_tactics
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-07 15:44:47 -08:00
Leonardo de Moura
33b72f1dd0 feat(frontends/lean/parser): apply type inference elaborator to fill remaining metavariables/holes (these are holes produced by tactics such as apply_tac)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-07 13:09:39 -08:00
Leonardo de Moura
bc3a6a3185 refactor(frontends/lean/parser): cleanup tactic support in the default lean parser
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-07 12:15:03 -08:00
Leonardo de Moura
1df9d18891 feat(frontends/lean): allow 'tactic hints' to be associated with 'holes'
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-06 14:49:39 -08:00
Leonardo de Moura
d46cf5fdd5 fix(frontends/lean/parser): display failed state in noninteractive mode, stop processing tactic commands when a Lean command is found
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-06 05:13:29 -08:00
Leonardo de Moura
e6fb6f7d1e feat(frontends/lean/parser): add assumption command, and allow Lean expressions (proof terms) to be used with apply tactic command
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-05 20:08:51 -08:00
Leonardo de Moura
1b176204b4 feat(frontends/lean/parser): allow the user to use a theorem/axiom name as an argument for the apply tactic command
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-05 19:03:12 -08:00
Leonardo de Moura
e1d44eec6b fix(frontends/lean/parser): bug in parse_tactic
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-05 17:40:55 -08:00
Leonardo de Moura
a564795fe6 fix(frontends/lean/parser): remove unnecessary '#' after error
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-05 17:27:08 -08:00
Leonardo de Moura
e069ce640b feat(frontends/lean/parser): add tactic abort command
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-05 17:15:19 -08:00
Leonardo de Moura
34654ad06b feat(tests/lean/interactive): add interactive mode test script
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-05 16:56:20 -08:00
Leonardo de Moura
e3848d43a2 feat(frontends/lean): improve tactic command parsing in interactive mode
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-05 16:28:08 -08:00
Leonardo de Moura
a1b5a8e50f fix(frontends/lean): check wheter the synthesized proof term has metavars or not
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-05 14:22:19 -08:00
Leonardo de Moura
056759880c feat(frontends/lean): add back (backtracking) command
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-05 04:39:08 -08:00
Leonardo de Moura
7b4ea75dee fix(frontends/lean): do not display Ctrl-D message on Windows
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-04 11:39:30 -08:00
Leonardo de Moura
e60e20a11d feat(frontends/lean): add Exit command
Remark: on Windows, Ctrl-D does not seem to work.
So, this commit also changes the Lean startup message.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-04 10:40:22 -08:00
Leonardo de Moura
d79b2babd3 fix(*): typo
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-02 08:46:47 -08:00
Leonardo de Moura
dd62af1641 feat(frontends/parser): simplified theorem definition using tactical proof
When using tactics for proving theorems, a common pattern is

     Theorem T : <proposition> := _.
          apply <tactic>.
          ...
          done.

This commit allows the user to write the simplified form:

     Theorem T : <proposition>.
          apply <tactic>.
          ...
          done.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-02 08:20:18 -08:00
Leonardo de Moura
a7027a1d00 feat(library/tactic): polish tactic API, and add new example showing how to implement tactics using Lua
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-30 00:16:39 -08:00
Leonardo de Moura
18eb9e427f fix(library/tactic): compilation warning
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-29 10:35:14 -08:00
Leonardo de Moura
98897b467d feat(frontends/lean/parser): add support for Lua expression code blocks
In expression code blocks, we do not have to write a "return".
After this commit, the argument of an apply command is a Lua expression instead of a Lua block of code. That is, we can now write

apply (** REPEAT(ORELSE(imp_tactic, conj_tactic, conj_hyp_tactic, assumption_tactic)) **)

instead of

apply (** return REPEAT(ORELSE(imp_tactic, conj_tactic, conj_hyp_tactic, assumption_tactic)) **)

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-29 10:21:24 -08:00
Leonardo de Moura
f9874cd675 feat(library/tactic): add to_tactic_ext, it allows functions that return tactics to be used where a tactic is expected
For example, after this commit, we can write

simple_tac = REPEAT(ORELSE(imp_tactic, conj_tactic)) .. assumption_tactic

instead of

simple_tac = REPEAT(ORELSE(imp_tactic(), conj_tactic())) .. assumption_tactic()

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-29 09:40:21 -08:00
Leonardo de Moura
066dacea31 feat(library/tactic): add show_tactic, and optional '.' in the end of tactic command
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-29 01:33:26 -08:00
Leonardo de Moura
6832b265e9 style(frontends/lean/parse): missing include
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-28 21:50:55 -08:00
Leonardo de Moura
5dfb3b8b56 feat(frontends/lean/parse): allow script-code blocks to be used in the apply command
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-28 21:48:30 -08:00
Leonardo de Moura
dae86c2ffa feat(frontends/lean/parser): add basic tactic support in the frontend
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-28 21:08:12 -08:00
Leonardo de Moura
f7e8545e97 refactor(frontends/lua): rename leanlua_state to script_state, and move it to util
This commit also minimizes the dependencies of script_state.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-27 14:57:36 -08:00
Leonardo de Moura
d87ad9eb7e refactor(util/lua): propagate C++ Lean exceptions in Lua
The following call sequence is possible:
C++ -> Lua -> C++ -> Lua -> C++

The first block of C++ is the Lean main function.
The main function invokes the Lua interpreter.
The Lua interpreter invokes a C++ Lean API.
Then the Lean API invokes a callback implemented in Lua.
The Lua callback invokes another Lean API.
Now, suppose the Lean API throws an exception.
We want the C++ exception to propagate over the mixed C++/Lua call stack.
We use the clone/rethrow exception idiom to achieve this goal.

Before this commit, the C++ exceptions were converted into strings
using the method what(), and then they were propagated over the Lua
stack using lua_error. A lua_error was then converted into a lua_exception when going back to C++.
This solution was very unsatisfactory, since all C++ exceptions were being converted into a lua_exception, and consequently the structure of the exception was being lost.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-27 12:25:29 -08:00
Leonardo de Moura
5346b67651 refactor(library/state): rename Lean state object to io_state
The idea is to make it clear that io_state is distinguish it from proof_state, and from leanlua_state.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-21 17:29:06 -08:00
Leonardo de Moura
69be5f6c94 feat(kernel/environment): track which modules were already imported
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-17 18:15:44 -08:00
Leonardo de Moura
8525e8534b feat(lua): expose parse_expr and parse_commands from frontends/lean in the Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-15 16:11:26 -08:00
Leonardo de Moura
19533c811b feat(library/script_evaluator): add abstract class that exposes only the API needed by frontend objects
The main motivation is to break the remove the dependency frontends/lean <-- bindings/lua.
This dependency is undesirable because we want to expose the frontends/lean parser and pretty printer objects at bindings/lua.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-15 12:13:09 -08:00
Leonardo de Moura
c4c548dc5d feat(*): simplify interrupt propagation
Instead of having m_interrupted flags in several components. We use a thread_local global variable.
The new approach is much simpler to get right since there is no risk of "forgetting" to propagate
the set_interrupt method to sub-components.

The plan is to support set_interrupt methods and m_interrupted flags only in tactic objects.
We need to support them in tactics and tacticals because we want to implement combinators/tacticals such as (try_for T M) that fails if tactic T does not finish in M ms.
For example, consider the tactic:

    try-for (T1 ORELSE T2) 5

It tries the tactic (T1 ORELSE T2) for 5ms.
Thus, if T1 does not finish after 5ms an interrupt request is sent, and T1 is interrupted.
Now, if you do not have a m_interrupted flag marking each tactic, the ORELSE combinator will try T2.
The set_interrupt method for ORELSE tactical should turn on the m_interrupted flag.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 21:45:48 -08:00
Leonardo de Moura
8190d4fed5 feat(lua): allow Lua scripts to update 'global' options
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 15:38:00 -08:00
Leonardo de Moura
31abc00db8 chore(*): add LCOV_EXCL_LINE to lean_unreachable statements
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 09:19:38 -08:00
Leonardo de Moura
7683188ab0 chore(emplace_back): use emplace_back when appropriate
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-10 11:14:04 -08:00
Leonardo de Moura
8c140ff86f feat(lua): allow lua scripts (embedded in Lean files) to access the environment
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-10 11:14:04 -08:00
Leonardo de Moura
57b9657bf0 feat(lua): add lua_exception for wrapping lua errors, and improve Lua error messages in the Lean frontend
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 15:19:26 -08:00
Leonardo de Moura
a9b2be0b9c feat(frontends/lean): add support for embedded Lua scripts in Lean files
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 13:56:04 -08:00
Leonardo de Moura
2141ee12f4 refactor(frontends/lean): use extension objects to store lean default frontend data in the environment
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 10:00:12 -08:00
Soonho Kong
044813615e fix: add '#include <tuple>' 2013-11-03 13:00:42 -05:00
Leonardo de Moura
bf998d8661 feat(frontends/lean/parser): allow 'typeless' definitions, the type is inferred by the system
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-01 08:51:49 -07:00
Leonardo de Moura
96dcd003c6 fix(frontends/lean/parser): associated position with 'type' placeholder
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-31 16:27:36 -07:00
Leonardo de Moura
d0009d0242 feat(frontends/lean): make the first argument of if-expression implicit, add support for marking implicit arguments on builtin symbols (aka semantic attachments)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-29 15:53:50 -07:00
Leonardo de Moura
92f5a31976 feat(kernel/expr): add new mk_app template for creating applications using a collection
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-27 08:53:58 -07:00
Leonardo de Moura
65a514ad8a fix(frontends/lean/parser): option propagation
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-24 19:04:06 -07:00
Leonardo de Moura
df07a84d11 feat(frontends/lean/parser): display elaborator error messages
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-24 18:48:53 -07:00
Leonardo de Moura
bbc265ded4 feat(frontends/lean): hook new elaborator in the default frontend
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-24 15:14:29 -07:00
Leonardo de Moura
71ccec5b9e refactor(frontends/lean/elaborator): delete old_elaborator, and create frontend_elaborator class that will be based on library/elaborator/elaborator
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-24 10:45:59 -07:00
Leonardo de Moura
1548ffabb1 feat(elaborator): add new elaborator interface
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:36 -07:00
Leonardo de Moura
85bfa45e6a refactor(kernel_exception): delete kernel_exception_formatter, and implement kernel_exception pretty printer as a virtual method
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:36 -07:00
Leonardo de Moura
d843d432d3 refactor(kernel): move printer and formatter objects to the kernel
The printer and formatter objects are not trusted code.
We moved them to the kernel to be able to provide them as an argument to the trace objects.
Another motivation is to eliminate the kernel_exception_formatter hack.
With the formatter in the kernel, we can implement the pretty printer for kernel exceptions as a virtual method.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:36 -07:00
Leonardo de Moura
15979ab991 fix(lean): fix warnings produced by cppcheck
Fix (relevant) warnings produced by http://cppcheck.sourceforge.net.
Most warnings produced were incorrect. The tool does not seem to support some of the C++11 new features.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-30 21:38:55 -07:00
Leonardo de Moura
6477708d78 refactor(debug): improve lean_unreachable(), now we can avoid 'fake' return statements
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-25 21:27:20 -07:00
Leonardo de Moura
e23813f15d Add support for creating unique internal names.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-24 11:01:30 -07:00
Leonardo de Moura
651c5d6751 Fix warnings and bugs related to unused variables.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-19 22:41:07 -07:00
Soonho Kong
ab6ca82e6f Update to suppress unused-parameter warnings 2013-09-19 22:40:34 -07:00
Leonardo de Moura
63e102055e Move metavariables to the kernel. This is the first step for implementing the new elaborator.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-15 12:09:01 -07:00
Soonho Kong
bc60b47295 Apply coding style 2013-09-13 18:48:09 -07:00
Leonardo de Moura
d54834279e Use consistent coding style for if-then-else
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-13 12:57:40 -07:00
Leonardo de Moura
8c735f1daa Use consistent coding style for spaces after ','
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-13 12:49:03 -07:00
Leonardo de Moura
2c68117adf Tag TODOs
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-13 12:25:21 -07:00
Leonardo de Moura
070c87bef0 Rename arith library files
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-13 08:55:09 -07:00
Soonho Kong
5c3866cd71 Use fullpath in #include directives, add missing STL headers 2013-09-13 03:35:29 -07:00
Leonardo de Moura
4c19cc6957 Rename lean frontend files. The prefix lean_ is not necessary anymore.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-12 20:09:35 -07:00
Renamed from src/frontends/lean/lean_parser.cpp (Browse further)