Commit graph

24 commits

Author SHA1 Message Date
Leonardo de Moura
8012c4f644 fix(kernel/environment): add weak reference to environment objects
We need weak references to environment objects because the environment has a reference to the type_checker and the type_checker has a reference back to the environment. Before, we were breaking the cycle using an "environment const &". This was a dangerous hack because the environment smart pointer passed to the type_checker could be on the stack. The weak_ref is much safer.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 11:29:08 -08:00
Leonardo de Moura
2c6d4d2225 fix(kernel/normalizer): do not apply substitutions in the normalizer
It is incorrect to apply substitutions during normalization.
The problem is that we do not have support for tracking justifications in the normalizer. So, substitutions were being silently applied during normalization. Thus, the correctness of the conflict resolution in the elaboration was being affected.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-29 02:14:48 -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
874f67c605 feat(normalizer): remove normalization rule t == t ==> true
This normalization rule is not really a computational rule.
It is essentially encoding the reflexivity axiom as computation.
It can also be abaused. For example, with this rule,
the following definition is valid:

Theorem Th : a = a := Refl b

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 14:02:48 -07:00
Leonardo de Moura
7cf83800c0 refactor(metavar): implement metavar_env, and use unification_constraint and trace objects in the type_checker, light_checker
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:36 -07:00
Leonardo de Moura
5b1b03bafd refactor(is_convertible): move from normalizer to type_checker class
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
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
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
Leonardo de Moura
3df6149daa Add support for metavariables in the type checker.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 11:09:59 -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
21c7a45f67 Relax definition of identity_stack. Fix printer for metavariable contexts.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 02:09:45 -07:00
Leonardo de Moura
d3bce584f4 Add support for new metavariable representation in the normalizer.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 01:57:21 -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
cad562a448 Add support for metavariables in the normalizer.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-16 19:32:28 -07:00
Leonardo de Moura
1be2a30c8c Fix bug in normalizer. We must create a scope whenever we extend the value stack.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-16 19:32:28 -07:00
Leonardo de Moura
f79f046294 Add partial support for metavariables in the normalizer
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-15 21:23:50 -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
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
Soonho Kong
5c3866cd71 Use fullpath in #include directives, add missing STL headers 2013-09-13 03:35:29 -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
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
b92bbeb83b Add casting propagation and normalization
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-06 20:45:26 -07:00
Leonardo de Moura
db88920f81 Rename normalize and type_check to normalizer and type_checker (using a consistent naming convention)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-02 08:43:38 -07:00
Renamed from src/kernel/normalize.cpp (Browse further)