Leonardo de Moura
6569b07b7c
feat(frontends/lean/parser): rename 'show' expression to 'have'
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-05 11:25:58 -08:00
Leonardo de Moura
9f08156a73
feat(frontends/lean/parser): combine Echo and Show commands into the 'print' command
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-05 11:03:35 -08:00
Leonardo de Moura
ce1213a020
feat(frontends/lean): use '(* ... *)' instead of '(** ... **)' for script code blocks
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-05 10:32:47 -08:00
Leonardo de Moura
028a9bd9bd
feat(frontends/lean/scanner): use Lua style comments in Lean
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-05 08:53:27 -08:00
Leonardo de Moura
f5cc2458a9
fix(frontends/lean/parser_calc): missing save calls
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-03 18:26:30 -08:00
Leonardo de Moura
9eb4dc4a81
feat(kernel, library/elaborator, frontends/lean): improve how elaborator_exceptions are displayed in the Lean frontend
...
This commit affects different modules.
I used the following approach:
1- I store the metavariable environment at unification_failure_justifications. The idea is to capture the set of instantiated metavariables at the time of failure.
2- I added a remove_detail function. It removes propagation steps from the justification tree object. I also remove the backtracking search space associated with higher-order unificiation. I keep only the search related to case-splits due to coercions and overloads.
3- I use the metavariable environment captured at step 1 when pretty printing the justification of an elaborator_exception.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-03 17:18:23 -08:00
Leonardo de Moura
cf35e7bed7
feat(frontends/lean): add support for disequalities in calculational proofs
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-02 22:47:45 -08:00
Leonardo de Moura
6329d1828d
feat(frontends/lean): reuse name expression
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-02 20:08:21 -08:00
Leonardo de Moura
ecc5d1bc3a
refactor(kernel): move printer to library, cleanup io_state interface
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-02 13:37:50 -08:00
Leonardo de Moura
0592261847
refactor(kernel/io_state): move io_state_stream to library
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-02 13:14:21 -08:00
Leonardo de Moura
b81d3309b9
fix(kernel): remove ios hack
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-02 13:03:25 -08:00
Leonardo de Moura
e714bd7982
feat(frontends/lean): add syntax sugar for applying Subst in calculational proofs
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-02 11:23:55 -08:00
Leonardo de Moura
111949b9be
feat(frontends/lean): calculational proofs
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-02 10:53:14 -08:00
Leonardo de Moura
0cb741285c
chore(*): do not type check imported modules when running .cpp tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-02 07:11:55 -08:00
Leonardo de Moura
d7493ea86c
refactor(frontends/lean/parser): use std::function
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-02 06:53:34 -08:00
Leonardo de Moura
5540fc861a
refactor(frontends/lean/parser): break parser in smaller chunks
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-02 06:48:40 -08:00
Leonardo de Moura
7d18e9b32e
refactor(frontends/lean/parser): cleanup
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-02 04:37:21 -08:00
Leonardo de Moura
43909ca66b
feat(frontends/lean/pp): pretty print SetOpaque command
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-01 13:16:44 -08:00
Leonardo de Moura
770145a361
feat(builtin): use namespaces when defining nat, int and real.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-01 12:55:09 -08:00
Leonardo de Moura
d633622d90
feat(frontends/lean/parser): namespaces
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-01 12:28:18 -08:00
Leonardo de Moura
0d815b8594
refactor(kernel/context): hide that the context is implemented using lists
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-31 19:43:50 -08:00
Leonardo de Moura
390a78a8d2
chore(frontends/lean/parser): remove 'Skipped' message
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 15:35:12 -08:00
Leonardo de Moura
08718e33dc
refactor(builtin): only load the kernel and natural numbers by default
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 13:35:37 -08:00
Leonardo de Moura
ecd62a1783
refactor(builtin/basic): rename basic.lean to kernel.lean
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 11:46:03 -08:00
Leonardo de Moura
72761f14e4
refactor(library/io_state): move to the kernel
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 11:20:23 -08:00
Leonardo de Moura
46a8300a2d
refactor(library/arith): move real and special function declarations to .lean files
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 11:02:22 -08:00
Leonardo de Moura
c3bc6afb12
refactor(library/arith): move int and nat declarations to .lean files.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 10:32:14 -08:00
Leonardo de Moura
097b10e424
refactor(kernel/builtin): move builtin declarations to basic
...
There is a lot to be done. We should do the same for Nat, Int and Real.
We also should cleanup the file builtin.cpp and builtin.h.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-29 22:00:03 -08:00
Leonardo de Moura
dbd122301a
feat(kernel/object): compact object serialization kind ids
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-29 19:19:24 -08:00
Leonardo de Moura
15621610e9
refactor(library/arith): replace Nat, Int, Real with simple variable decls instead of semantic attachments
...
This commit also fixes bugs in the Alias command.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-29 17:04:36 -08:00
Leonardo de Moura
a1a5fb101d
feat(frontends/lean): add Alias command
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-29 16:25:45 -08:00
Leonardo de Moura
dfe46b9d25
refactor(kernel/builtin): move definition and axioms to basic.lean
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-29 14:01:30 -08:00
Leonardo de Moura
b1efdac07b
feat(frontends/lean/parser): universe declarations
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-29 13:15:09 -08:00
Leonardo de Moura
411ebbc3c1
refactor(library/basic_thms): move the proof of all basic theorems to a .Lean file
...
This commit also adds several new theorems that are useful for implementing the simplifier.
TODO: perhaps we should remove the declarations at basic_thms.h?
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-29 03:04:49 -08:00
Leonardo de Moura
41c1010043
feat(frontends/lean/parser): make Import command use binary Lean files
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-28 19:20:04 -08:00
Leonardo de Moura
aee1c6d3f3
feat(kernel): export/import (.olean) binary files
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-28 17:31:35 -08:00
Leonardo de Moura
22bebbf242
feat(kernel/object): serializer for kernel objects
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-28 14:39:10 -08:00
Leonardo de Moura
1fd81dd3a1
feat(frontends/lean/parser): disable verbose messages when importing files
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-28 12:24:13 -08:00
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
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
418623b874
feat(kernel/replace_fn): add template replace that captures commonly used pattern
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-17 18:31:59 -08:00
Leonardo de Moura
af42078205
fix(kernel): incorrect use of scoped_map
...
This commit also adds a new test that exposes the problem.
The scoped_map should not be used for caching values in the normalizer and type_checker. When we extend the context, the meaning of all variables is modified (we are essentially performing a lift). So, the values stored in the cache are not correct in the new context.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-16 15:11:39 -08:00
Leonardo de Moura
2fee2def72
feat(library/basic_thms): simplify DoubleNegElim
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-16 13:19:19 -08:00
Leonardo de Moura
de53e92de8
feat(library/basic_thms): add ExistsElim theorem
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-16 12:43:34 -08:00
Leonardo de Moura
8f5c2b7d9f
feat(library/basic_thms): add Refute theorem
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-16 12:03:31 -08:00
Leonardo de Moura
19ad39159e
feat(library/basic_thms): add ForallIntro theorem
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-15 17:35:31 -08:00
Leonardo de Moura
82dfb553d5
feat(library/basic_thms): add ExistsIntro theorem
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-15 16:26:23 -08:00
Leonardo de Moura
160a8379ef
feat(library/elaborator): provide the metavar_env to instantiate and lift_free_vars in the elaborator, it will minimize the number of local_entries needed
...
The modifications started at commit 1852c86948
made a big difference. For example, before these changes test tests/lean/implicit7.lean generated complicated constraints such as:
[x : Type; a : ?M::29[inst:1 ?M::0[lift:0:1]] x] ⊢ Pi B : Type, (Pi _ : x, (Pi _ : (?M::35[inst:0 #0 , inst:1 #2 , inst:2 #4 , inst:3 #6 , inst:5 #5 , inst:6 #7 , inst:7 #9 , inst:9 #9 , inst:10 #11 , inst:13 ?M::0[lift:0:13]] x a B _), (?M::36[inst:1 #1 , inst:2 #3 , inst:3 #5 , inst:4 #7 , inst:6 #6 , inst:7 #8 , inst:8 #10 , inst:10 #10 , inst:11 #12 , inst:14 ?M::0[lift:0:14]] x a B _ _))) ≈
?M::22 x a
After the changes, only very simple constraints are generated. The most complicated one is:
[] ⊢ Pi a : ?M::0, (Pi B : Type, (Pi _ : ?M::0, (Pi _ : B, ?M::0))) ≈ Pi x : ?M::17, ?M::18
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-14 15:59:35 -08:00
Leonardo de Moura
02ee31b786
feat(kernel/normalizer): provide the metavar_env to instantiate and add_inst in the normalizer, it will minimize the number of local_entries needed
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-14 15:41:50 -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
2e5e5e187f
chore(util/rc): remove unnecessary argument from LEAN_COPY_REF and LEAN_MOVE_REF macros
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-13 15:01:24 -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
3457fe5935
chore(kernel): rename read_only_environment and read_write_environment
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-12 16:48:33 -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
c0b9c7ffc4
refactor(library/io_state): simplify regular/diagnostic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-10 13:09:35 -08:00
Leonardo de Moura
e0eeb7c8d5
feat(frontends/lean/operator_info): add << for diagnostic and regular streams
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-10 12:52:31 -08:00
Leonardo de Moura
90f88acf42
feat(frontends/lean): relax compatible_denotation predicate
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-10 12:42:29 -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
8f2fe273ea
refactor(*): isolate std::thread dependency
...
This commit allows us to build Lean without the pthread dependency.
It is also useful if we want to implement multi-threading on top of Boost.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-09 15:20:26 -08:00
Leonardo de Moura
3ea09daf44
fix(frontends/lean/frontend): is_coercion for environment objects that have parents
...
Bug was exposed by tests/lua/coercion_bug1.lua
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-08 17:47:00 -08:00
Leonardo de Moura
2a80807fef
refactor(frontends/lean/pp): replace weak_ref with a strong reference, add new function (lean_formatter) for creating a Lean object formatter in the Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-08 17:33:18 -08:00
Leonardo de Moura
340d643d89
fix(library/kernel_bindings): make sure that when a formatter is invoked and it has a reference to an environment object, we get a read-only lock to the environment object
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-08 16:55:55 -08:00
Leonardo de Moura
da613f67a8
refactor(frontends/lean/pp): replace dangerous frontend reference with a weak_ref to the environment
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-08 16:42:12 -08:00
Leonardo de Moura
759fcb7b4f
refactor(kernel/formatter): hide 'unsafe' constructor
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-08 15:39:26 -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
1ff6013594
fix(frontends/lean/frontend_elaborator): must elaborate type attached to placeholder, it may also contain holes
...
The test tactic14.lean exposes the problem.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-07 15:37:59 -08:00
Leonardo de Moura
e2999d3ff6
feat(*): add component name to check_stack and check_system
...
I also reduced the stack size to 8 Mb in the tests at tests/lean and tests/lean/slow. The idea is to simulate stackoverflow conditions.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-07 15:11:55 -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
195ea24d71
refactor(kernel/type_checker): pass buffer<unification_constraint> as a pointer
...
The idea is to make it an optional parameter independent of metavar_env.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-07 10:27:11 -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
2ddcc32c1d
fix(frontends/lean/notation): change the precedence of '->'
...
It should match the precedence of the implication '=>'.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-06 13:23:24 -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
bcc8b67592
chore(*): consistent file name convention
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-03 12:40:52 -08:00
Leonardo de Moura
f80106a895
chore(*): use 'explicit operator bool' everywhere.
...
operator bool() may produce unwanted conversions.
For example, we had the following bug in the code base.
...
object const & obj = find_object(const_name(n));
if (obj && obj.is_builtin() && obj.get_name() == n)
...
obj.get_name() has type lean::name
n has type lean::expr
Both have 'operator bool()', then the compiler uses the operator to
convert them to Boolean, and then compare the result.
Of course, this is not our intention.
After this commit, the compiler correctly signs the error.
The correct code is
...
object const & obj = find_object(const_name(n));
if (obj && obj.is_builtin() && obj.get_name() == const_name(n))
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-02 23:02:45 -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
1ec8f9d536
feat(kernel): add abstraction (aka function extensionality) axiom
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-01 13:57:14 -08:00
Leonardo de Moura
70e06f8e86
feat(library/hidden_defs): hidden definitions are just hints for tactics and solvers
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-01 10:27:27 -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