Leonardo de Moura
e3efe39eeb
fix(elaborator): fix bug in higher-order matching/unification
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-24 17:53:37 -07:00
Leonardo de Moura
d1a2a4ea7e
feat(frontends/lean/elaborator): add support for coercions in let declarations
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-24 17:01:06 -07:00
Leonardo de Moura
872b698bc3
feat(elaborator): add option m_assume_injectivity for getting more concise solutions
...
We may miss solutions, but the solutions found are much more readable.
For example, without this option, for elaboration problem
Theorem Example4 (a b c d e : N) (H: (a = b ∧ b = e ∧ b = c) ∨ (a = d ∧ d = c)) : (h a c) = (h c a) :=
DisjCases H
(fun H1 : _,
let AeqC := Trans (Conjunct1 H1) (Conjunct2 (Conjunct2 H1))
in CongrH AeqC (Symm AeqC))
(fun H1 : _,
let AeqC := Trans (Conjunct1 H1) (Conjunct2 H1)
in CongrH AeqC (Symm AeqC))
the elaborator generates
Theorem Example4 (a b c d e : N) (H : a = b ∧ b = e ∧ b = c ∨ a = d ∧ d = c) : (h a c) = (h c a) :=
DisjCases
H
(λ H1 : if
Bool
(if Bool (a = b) (if Bool (if Bool (if Bool (b = e) (if Bool (b = c) ⊥ ⊤) ⊤) ⊥ ⊤) ⊥ ⊤) ⊤)
⊥
⊤,
let AeqC := Trans (Conjunct1 H1) (Conjunct2 (Conjunct2 H1)) in CongrH AeqC (Symm AeqC))
(λ H1 : if Bool (if Bool (a = d) (if Bool (d = c) ⊥ ⊤) ⊤) ⊥ ⊤,
let AeqC := Trans (Conjunct1 H1) (Conjunct2 H1) in CongrH AeqC (Symm AeqC))
The solution is correct, but it is not very readable. The problem is that the elaborator expands the definitions of \/ and /\.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-24 16:47:50 -07:00
Leonardo de Moura
a7f94b55db
fix(frontends/lean/elaborator): fix bugs and adjust tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-24 15:29:56 -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
c9f7b8bce2
feat(frontends/lean): add get_coercions method
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-24 14:38:09 -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
f1e0d6ec29
refactor(beta_reduction): move beta reduction functions to the kernel, delete reduce.cpp file and tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-23 15:44:26 -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
61ccaf741c
fix(frontend/lean): minor modification to be able to execute lean frontend while refactoring elaborator
...
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
ddb90d3038
feat(kernel): add unification_constraint and trace objects to the kernel
...
Trace objects will be used to justify steps performed by engines such as the elaborator. We use them to implement non-chronological backtracking in the elaborator. They are also use to justify to the user why something did not work.
The unification constraints are in the kernel because the type checker may create them when type checking a term containing metavariables.
Remark: a minimalistic kernel does not need to include metavariables, unification constraints, nor trace objects. We include these objects in our kernel to minimize code duplication.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:36 -07:00
Leonardo de Moura
59914a36f3
refactor(metavar): reorganize and simplify metavariables
...
- Use hierarchical names instead of unsigned integers to identify metavariables.
- Associate type with metavariable.
- Replace metavar_env with substitution.
- Rename meta_ctx --> local_ctx
- Rename meta_entry --> local_entry
- Disable old elaborator
- Rename unification_problems to unification_constraints
- Add metavar_generator
- Fix metavar unit tests
- Modify type checker to use metavar_generator
- Fix placeholder module
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
2f29ff70d7
Implement higher-order unification
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-18 20:46:00 -07:00
Leonardo de Moura
ad901ce087
Use consistent naming conventions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 14:43:07 -07:00
Leonardo de Moura
30b19c314a
Add basic support for metavariables at is_convertible. Swap is_convertible arguments to make it more intuitive.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 07:15:47 -07:00
Leonardo de Moura
da09e7217a
Cleanup meta_entry code
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-16 19:32:28 -07:00
Leonardo de Moura
99a163f11d
Simplify metavariable context. Now, we have only 'lift' and 'inst' instead of 'subst', 'lift' and 'lower'
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-16 19:32:28 -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
573ec5ccc2
Rename import_all. The idea is to use consistent name for library files.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-13 09:06:46 -07:00
Leonardo de Moura
0c09e4524a
Use consistent names for import functions, and library files.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-13 08:58:34 -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
Leonardo de Moura
26097475fd
Use fullpath in #include directives.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-12 20:04:10 -07:00
Leonardo de Moura
3657320edb
Add basic list functions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-11 19:48:54 -07:00
Leonardo de Moura
6fe86ffefd
Fix initialized memory error reported by Valgrind. Disable 2 tests that produce memory leaks due to a bug in g++.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-10 13:51:02 -07:00
Leonardo de Moura
4c67721d32
Fix test error on Cygwin
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-09 18:35:11 -07:00
Leonardo de Moura
2ca30571b4
Display the input term in the output of the Check command. It is useful to see the fully elaborated term.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-08 22:55:21 -07:00
Leonardo de Moura
59a589037e
Keep expanded form when pretty printings variable declarations with implicit marks (i.e., curly braces)
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-08 11:23:46 -07:00
Leonardo de Moura
df116f88e0
Improve pretty printer for Pi's
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-08 11:04:07 -07:00
Leonardo de Moura
33c4b44b2b
Encapsulate context implementation. The current implementantion based on lists may be a performance problem in the future, and we should be able to change it without affecting the whole code base.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-07 11:15:11 -07:00
Leonardo de Moura
c674bb3790
Add castlib as an independent library
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-06 23:40:47 -07:00
Leonardo de Moura
7a9d53d0d7
Refactor arith libraries
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-06 23:19:47 -07:00
Leonardo de Moura
7eab229114
Improve check_pi in lean elaborator
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-06 18:58:33 -07:00
Leonardo de Moura
c0c2f52087
Add Cast, DomInj and RanInj. Improve operator << for lean_frontend objects.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-06 18:32:15 -07:00
Leonardo de Moura
b62816cc25
Fix problem with pretty printer. Add another test for elaborator
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-06 18:01:11 -07:00
Leonardo de Moura
edafd519e1
Add missing case to elaborator
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-06 17:43:08 -07:00
Leonardo de Moura
26bf7bcaac
Fix bug in the elaborator. Move character ' to class A
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-06 17:12:35 -07:00
Leonardo de Moura
8840b37258
Fix type checker and elaborator for let expressions. Fix get_coercions (we need to pass the context). Fix pretty printer for def_type_mismatch_exception.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-06 11:02:00 -07:00