Commit graph

2558 commits

Author SHA1 Message Date
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
03cf9be8b5 doc(doc/lean/calc.md): link to Nat.lean
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-03 11:59:24 -08:00
Leonardo de Moura
66ec538c63 doc(doc/lean/calc.md): calculational proof documentation
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-03 11:52:21 -08:00
Leonardo de Moura
5b5cebe750 refactor(builtin/Nat): use obtain-from instead of ExistsElim, and use more user-friendly argument order for Induction
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-03 10:33:57 -08:00
Leonardo de Moura
9f3706e365 feat(builtin/macros): add obtain-from macro for ExistsElim
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-03 10:32:49 -08:00
Leonardo de Moura
d7efdff83d feat(builtin/Nat): add more leq theorems
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-02 22:48:10 -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
92c7145d7f feat(kernel/expr): maximize sharing before serializing
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-02 20:03:42 -08:00
Leonardo de Moura
2d5800ace4 feat(builtin/Nat): leq axiom, and some theorems
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-02 18:24:32 -08:00
Leonardo de Moura
502d9f47ac test(tests/lean): new test full of holes
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-02 16:31:52 -08:00
Leonardo de Moura
9620b00e24 feat(kernel/metavar): is instantiate_metavars, we are also instantiating assigned metavariables that occur in the local context of unassinged ones.
This modification improves the effectiveness of the process_metavar_inst procedure in the Lean elaborator.

For example, suppose we have the constraint

   ctx |- ?M1[inst:0 ?M2] == a

If ?M1 and ?M2 are unassigned, then we have to consider the two possible solutions:

        ?M1 == a
    or
        ?M1 == #0 and ?M2 == a

On the other hand, if ?M2 is assigned to b, then we can ignore the second case.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-02 16:08:38 -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
9c5fa72f56 fix(library/elaborator): avoid unused variable warning in release build
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-02 12:40:41 -08:00
Leonardo de Moura
430b75f38f test(tests/lean): add version of the Nat library full of holes
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-02 12:31:13 -08:00
Leonardo de Moura
307099b1cb refactor(builtin/Nat): cleanup all proofs using calculational proof style
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-02 12:13:26 -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
49425f1a5b feat(builtin/Nat): multiplication axioms and theorems
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-01 21:32:07 -08:00
Leonardo de Moura
d72b165db4 feat(builtin/Nat): cleanup and add PlusAssoc
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-01 17:19:12 -08:00
Leonardo de Moura
aa009b6b05 feat(builtin/Nat): add basic axioms and theorems
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-01 15:53:53 -08:00
Leonardo de Moura
b2a8f4118d feat(library/elaborator): process ho-match before normalizing
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-01 14:46:19 -08:00
Leonardo de Moura
a299778c88 chore(examples/lean): use macros in examples
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-01 14:01:12 -08:00
Leonardo de Moura
7726ccad28 chore(builtin): rename nat, int and real modules to Nat, Int and Real.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-01 13:52:25 -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
c423198a69 feat(builtin/kernel): add Not.*Elim theorems
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-01 11:35:21 -08:00
Leonardo de Moura
a8bc9fb4e0 refactor(builtin/kernel): mark exists as opaque after proving key theorems
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-01 11:00:32 -08:00
Leonardo de Moura
74cae2a154 refactor(library/elaborator): remove hackish rule
After the recent fixes, the hack in process_metavar is not needed anymore.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-01 10:55:39 -08:00
Leonardo de Moura
5f29146e0b feat(library/elaborator): use is_convertible for constraints without metavariables in the elaborator
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-01 03:14:01 -08:00
Leonardo de Moura
cbd1f98365 fix(library/elaborator): bug at method process_metavar_inst, add new test that exposed the bug
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-01 03:02:41 -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
1cb7408c46 fix(kernel/normalizer): metavariable reification was incorrect, add tst11 at tests/kernel/normalizer.cpp to expose the bug
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-31 16:24:36 -08:00
Leonardo de Moura
cd3bbb1ebf fix(kernel/builtin): enforcing design decision: semantic attachments are NOT simplifiers, they should do only evaluation
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-31 10:14:17 -08:00
Leonardo de Moura
c485b4bc4c fix(kernel/environment): binary file reader, force the file to be read in binary mode
We need this flag to be able to read the file on Windows.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 18:20:40 -08:00
Leonardo de Moura
1f6e959139 feat(deserializer): protect against corrupted binary files
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 18:05:38 -08:00
Leonardo de Moura
c473a484bb feat(util/object_serializer): protect against corrupted files
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 17:58:20 -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
909b10f515 fix(builtin): dependency
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 15:31:19 -08:00
Leonardo de Moura
931e196e83 fix(build): problem with reading LEAN_PATH on cygwin
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 15:12:31 -08:00
Leonardo de Moura
cc07c440e1 refactor(builtin): move pre-compiled object files to subdirectory
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 13:46:39 -08:00
Leonardo de Moura
49698bd053 chore(library/all): remove unnecessary files
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 13:37:25 -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