Commit graph

2909 commits

Author SHA1 Message Date
Leonardo de Moura
fe0cee7536 feat(frontends/lean): add frontend elaborator
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-24 18:25:56 -07:00
Leonardo de Moura
d7436e600b fix(library/resolve_macro): typo
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-24 17:40:58 -07:00
Leonardo de Moura
603dafbaf7 refactor(kernel): remove 'let'-expressions
We simulate it in the following way:
1- An opaque 'let'-expressions (let x : t := v in b) is encoded as
      ((fun (x : t), b) v)
   We also use a macro (let-macro) to mark this pattern.
   Thus, the pretty-printer knows how to display it correctly.

2- Transparent 'let'-expressions are eagerly expanded by the parser.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-24 16:27:27 -07:00
Leonardo de Moura
609aeae390 feat(kernel/type_checker): expose app_delayed_justification
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-24 14:54:37 -07:00
Leonardo de Moura
2c0f596665 fix(library/choice): avoid assertion violation when Lua API is misused
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-24 12:14:38 -07:00
Leonardo de Moura
3169f8c126 feat(library): add mk_explicit/is_explicit procedures for '@'-expressions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-24 12:11:27 -07:00
Leonardo de Moura
d915f0cc32 refactor(kernel/converter): converter should fail instead of relying on unification hints for solving a constraint, the hints must be applied by the frontend
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-24 09:00:14 -07:00
Leonardo de Moura
d8a8300a4f fix(kernel/expr): initialization problem
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 16:55:51 -07:00
Leonardo de Moura
61595f516c fix(frontends/lean/notation_cmd): initialization bug
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 16:20:28 -07:00
Leonardo de Moura
aa8b5655dd feat(frontends/lean): add notation overwrite
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 16:10:36 -07:00
Leonardo de Moura
60f230a206 doc(library/unifier): ignore flex-flex constraints
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 14:33:09 -07:00
Leonardo de Moura
7df397fe63 test(lua): add universe constraint unifier test
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 14:19:02 -07:00
Leonardo de Moura
a0e4dccdac refactor(kernel/constraint): rename choice constraint fields
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 13:52:03 -07:00
Leonardo de Moura
60c60c6cf5 feat(library/kernel_bindings): add mk_choice_cnstr to Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 13:39:21 -07:00
Leonardo de Moura
6d14de76f3 feat(kernel/constraint): add 'delayed' flag to choice constraints
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 12:56:06 -07:00
Leonardo de Moura
66016df0ad feat(library/unifier): add imitation step for macros
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 12:44:22 -07:00
Leonardo de Moura
2fa5b17592 feat(library/unifier): add unifier.max_steps unifier.use_exceptions options
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 12:38:57 -07:00
Leonardo de Moura
7b188ea37e feat(library/unifier): implement flex-rigid case
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 11:00:35 -07:00
Leonardo de Moura
68d55ef398 doc(library/unifier): document some of the unifier_fn methods
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 08:22:38 -07:00
Leonardo de Moura
9f7b92a410 refactor(library/unifier): combine active and delayed constraint sets
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 21:10:59 -07:00
Leonardo de Moura
4da9c2a2cb fix(emacs): modify emacs mode to reflect recent changes
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 17:56:53 -07:00
Leonardo de Moura
5bd86754af feat(frontends/lean/builtin_cmds): change notation for marking implicit/cast parameter in sections
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 17:51:00 -07:00
Leonardo de Moura
228f51dcfa feat(library/unifier): add support for choice constraint
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 17:21:24 -07:00
Leonardo de Moura
611f29a954 chore(library/elaborator): remove dead code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 16:35:00 -07:00
Leonardo de Moura
c8a07dee53 feat(library/unifier): add unifier_plugin support, and unit test with plugin implemented using Lua
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 16:27:04 -07:00
Leonardo de Moura
b936c4d860 test(lua): add type checker test
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 14:13:30 -07:00
Leonardo de Moura
238a0dbfba fix(library/unifier): memory violation, and missing set_conflict
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 14:09:06 -07:00
Leonardo de Moura
25cb1bf6a1 fix(kernel/converter): use type_checker::scope to make sure we restore the cache, and remove constraints when is_def_eq fails in the converter
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 14:08:54 -07:00
Leonardo de Moura
a1d94d71ec refactor(kernel/converter): eliminate converter::context, use type_checker directly
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 13:52:47 -07:00
Leonardo de Moura
edb2e85898 refactor(kernel/type_checker): remove type_checker::imp
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 13:39:58 -07:00
Leonardo de Moura
29a00c46d0 feat(library/unifier): add main loop and resolve_conflict
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 11:57:10 -07:00
Leonardo de Moura
644c387cfe refactor(kernel/constraint): rename: level constraints are also equality constraints
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 10:50:47 -07:00
Leonardo de Moura
1c47bd4847 fix(kernel/converter): remove temporary workaround, and temporarily disable unit test
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 10:39:22 -07:00
Leonardo de Moura
73666af4a4 fix(library/register_module): missing open_unifier
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 10:01:51 -07:00
Leonardo de Moura
c7c5e41653 fix(frontends/lean/parser): warning when compiling in release mode
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 09:58:05 -07:00
Leonardo de Moura
3953d4d122 feat(kernel/type_checker): add push/pop methods to type_checker, they control the cache, and allow the type checker to reuse results even when it is used inside of a backtracking search
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 09:58:05 -07:00
Leonardo de Moura
eca22edda3 fix(kernel/type_checker): restore type checker cache when a failure occurs, do not send constraints to add_cnstr_fn when a type checker failure occurrs
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 09:00:32 -07:00
Leonardo de Moura
9c745057b4 feat(library/unifier): add unify_fn skeleton
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-21 20:08:39 -07:00
Leonardo de Moura
aac3830e31 fix(kernel/converter): add temporary fix, we need to be able to backtrack constraints
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-21 20:08:39 -07:00
Leonardo de Moura
f9a21166f0 feat(kernel/type_checker): add type_checker::is_def_eq method that takes a justification as argument
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-21 20:08:39 -07:00
Leonardo de Moura
fedbf8595b feat(kernel/metavar): collect unassigned metavariables while instantiating
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-21 16:58:09 -07:00
Leonardo de Moura
bf8f3318d8 feat(library): add unifier module skeleton
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-21 13:38:17 -07:00
Leonardo de Moura
37bee8c852 refactor(kernel/type_checker): simplify replace constraint_handler with closure
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-21 12:25:54 -07:00
Leonardo de Moura
86a56fbd2d feat(library/kernel_bindings): expose methods substitution::for_each_expr and substitution::for_each_level in the Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-21 12:25:54 -07:00
Leonardo de Moura
2c3e3cb544 refactor(kernel/abstract): add abstract_locals, and remove abstract_p
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-21 12:25:54 -07:00
Leonardo de Moura
67088b130e refactor(kernel/constraint): simplify constraint interface, and add choice constraint
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-21 12:25:54 -07:00
Leonardo de Moura
9e50d5a1b8 test(util/lazy_list): add simple lazy_list example
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-21 12:25:54 -07:00
Leonardo de Moura
2589d60bfd feat(frontends/lean): add nameless 'have' expression
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-20 17:18:18 -07:00
Leonardo de Moura
4b227409bf feat(frontends/lean): add 'then have' expression
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-20 14:27:21 -07:00
Leonardo de Moura
4560413a92 feat(frontends/lean): add '[fact]' modifier for 'have' expression
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-20 11:58:05 -07:00