Commit graph

944 commits

Author SHA1 Message Date
Leonardo de Moura
72bce91c18 refactor(library/unifier): move inductive datatype support to inductive_unifier_plugin
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-05 11:00:35 -07:00
Leonardo de Moura
e445515f2b refactor(kernel): move standard and hott kernel instantiations to library
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-05 10:31:27 -07:00
Leonardo de Moura
ab929d7201 refactor(library/unifier): store the unifier_plugin in the environment
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-05 10:25:58 -07:00
Leonardo de Moura
a52c9f4e2b feat(library/unifier): add option 'unifier.unfold_opaque', remove option 'unifier.use_exceptions' (the user should not be able to change this)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-05 09:43:16 -07:00
Leonardo de Moura
efabd2280c feat(library/unifier): allow unifier to unfold opaque definitions of the current module
It is not clear whether this is a good idea or not. In some cases, it seems to do more harm than good.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-05 00:46:03 -07:00
Leonardo de Moura
ac1585fd1a feat(library/unifier): divide constraints in clear groups
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-05 00:04:38 -07:00
Leonardo de Moura
f242971b55 feat(library/unifier): delay constraints where the lhs or rhs are of the form (?m ... (intro ...))
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-04 23:36:31 -07:00
Leonardo de Moura
1e40525a0c fix(library/unifier): simple bug
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-04 21:15:32 -07:00
Leonardo de Moura
d7cb1952ae feat(kernel): simplify choice_fn, and make its interface closer to the unifier_plugin interface
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-04 12:47:33 -07:00
Leonardo de Moura
b94ce412ae fix(library/unifier): non-termination
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-04 10:32:01 -07:00
Leonardo de Moura
e0501104e2 feat(library/tactic): add 'fixpoint' tactic
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-04 01:30:28 -07:00
Leonardo de Moura
7fb2b0f6d8 feat(kernel): add method 'may_reduce_later' to normalizer_extension, and improve unifier
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-03 22:31:05 -07:00
Leonardo de Moura
110b622b83 feat(library/unifier): add support for unification constraints of the form "(elim ... (?m ...)) =?= t", where elim is an eliminator
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-03 20:41:51 -07:00
Leonardo de Moura
c854ad3d65 refactor(library/unifier): add is_def_eq alias
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-03 18:01:59 -07:00
Leonardo de Moura
aba4534acb feat(library/unifier): 'forget' justifications after finding a solution, the justifications are only needed inside the unifier (for implementing nonchronological backtracking)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-03 14:14:07 -07:00
Leonardo de Moura
a009225435 feat(kernel/metavar): expose destructive assign
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-03 14:07:47 -07:00
Leonardo de Moura
abbd054b51 feat(library/tactic): add eassumption tactic, and remove redundant 'subgoals' from apply tactic
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-03 13:04:46 -07:00
Leonardo de Moura
079592c446 feat(library/unifier): eagerly apply substitution to improve quick failure
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-03 12:58:30 -07:00
Leonardo de Moura
c9cfb844f1 feat(library/unifier): add 'quick' failure
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-03 11:28:21 -07:00
Leonardo de Moura
dd96bb151b refactor(library/unifier): reduce the number unify procedure 'flavors'
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-03 11:15:43 -07:00
Leonardo de Moura
d63ccbcf94 fix(library/unifier): missing case
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-03 10:51:59 -07:00
Leonardo de Moura
0ff145e59b feat(library/tactic): add apply tactic
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-03 09:20:01 -07:00
Leonardo de Moura
c9994ca00c feat(library/unifier): when projecting give preference to most recent locals
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-03 09:01:29 -07:00
Leonardo de Moura
e3ab0a1d10 feat(frontends/lean): improve error messages when users forget to import 'tactic'
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-03 08:33:29 -07:00
Leonardo de Moura
6b8b5f3dd8 feat(library/tactic): expose more builtin tactics, cleanup expr_to_tactic procedure
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-03 08:06:28 -07:00
Leonardo de Moura
a7d660f875 feat(frontends/lean): add command for customizing the behavior of proof-qed blocks: we can automatically register tactics to be automatically applied before each component
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 20:45:10 -07:00
Leonardo de Moura
5527955ba8 feat(frontends/lean): add 'proof-qed' notation
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 19:30:48 -07:00
Leonardo de Moura
138267b53a feat(frontends/lean/elaborator) add trick for improving error messages when mixing tactics, elaboration and exact tactic
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 18:58:32 -07:00
Leonardo de Moura
60c637fb9d feat(library/tactic): add 'exact' tactic
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 18:37:32 -07:00
Leonardo de Moura
37b5b7c4c2 feat(library/tactic): rename 'exact' to 'assumption', 'exact' is a different tactic
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 18:10:42 -07:00
Leonardo de Moura
6a6ebd5c2d refactor(kernel/metavar): add method instantiate as alias for instantiate_metavars_wo_jst
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 15:39:25 -07:00
Leonardo de Moura
3e1bb96935 feat(library/tactic/goal): propagate tag (for position information) from goal to subgoal
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 14:47:18 -07:00
Leonardo de Moura
ee531ec0e2 feat(frontends/parser): improve error message when an apply tactic refers a local constant that is not marked as [fact]
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 14:09:01 -07:00
Leonardo de Moura
0f27856e4a feat(library/tactic): new apply tactic
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 13:14:50 -07:00
Leonardo de Moura
6ab46396d8 feat(library/tactic): expose 'trace' tactic
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 10:52:45 -07:00
Leonardo de Moura
e1d909455c refactor(library/tactic): add namespace 'tactic', improve expr_to_tactic failure error message
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 10:45:09 -07:00
Leonardo de Moura
a66a08c89e feat(frontends/lean): parse strings as expressions of type 'string.string'
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 10:00:55 -07:00
Leonardo de Moura
0198dfc7c5 feat(frontends/lean): parse numerals as expressions of type 'num.num'
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 08:09:33 -07:00
Leonardo de Moura
7593ee1468 refactor(library/standard): remove parameter from 'tactic' inductive type
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 08:09:24 -07:00
Leonardo de Moura
b2b76b078f feat(frontends/lean): remove build_tactic_cmds, and use expressions for representing tactics
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-01 20:43:53 -07:00
Leonardo de Moura
cbac21ec7f feat(library/tactic): add trick for 'embedding' tactics inside Lean expressions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-01 19:05:22 -07:00
Leonardo de Moura
2df92b0701 refactor(library/tactic): simplify proof_state
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-01 18:02:17 -07:00
Leonardo de Moura
4cb5f97038 refactor(library/tactic): simplify tactic framework, no more proof builders
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-01 16:11:19 -07:00
Leonardo de Moura
ad12abcdb4 fix(library/unifier): bug in process_eq_constraint
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-30 18:22:05 -07:00
Leonardo de Moura
cb000eda13 refactor(kernel): store binder_infor in local constants
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-30 11:37:46 -07:00
Leonardo de Moura
c2ab31113f refactor(library/tactic): remove cex_builder and 'precision' for proof_state's
These two features make sense for solvers, but not in a general purpose tactic framework for building proofs like the one in Lean.

In most cases, we cannot build a counterexample anyway. These two features should be added in a custom framework for combining preprocessing techniques like in Z3.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-30 08:48:07 -07:00
Leonardo de Moura
8d584e54da feat(frontends/lean): add exact_apply
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-30 00:51:11 -07:00
Leonardo de Moura
360e9b9486 feat(library/tactic): add apply tactic
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-29 18:33:53 -07:00
Leonardo de Moura
a8f9594046 refactor(kernel/instantiate): rename instantiate_params to instantiate_univ_params
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-29 12:09:55 -07:00
Leonardo de Moura
937d7b2813 fix(library/tactic): unfold tactic
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-29 12:04:58 -07:00
Leonardo de Moura
6d09d82a7c feat(frontends/lean): add notation for orelse tactic, add show and now tactics
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-29 11:39:18 -07:00
Leonardo de Moura
a1bbb09de4 feat(frontends/lean): add notation for then tactic
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-29 11:24:56 -07:00
Leonardo de Moura
15f270d9f3 fix(library/tactic): memory leak that only happens when compiling with clang++
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-29 11:07:06 -07:00
Leonardo de Moura
6891f48c67 fix(library/module): do not store full path of imported modules
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-29 10:48:57 -07:00
Leonardo de Moura
ffa175009b feat(frontends/lean): use tactics for solving unassigned metavariables
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-29 09:50:16 -07:00
Leonardo de Moura
ec18bd93f9 feat(frontends/lean): send tactic hint table to elaborator
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-29 07:03:25 -07:00
Leonardo de Moura
193ce35419 refactor(frontends/lean/inductive_cmd): redesign inductive datatype elaboration, use the new elaborator, and use simpler algorithm to infer the resulting universe
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-28 15:33:56 -07:00
Leonardo de Moura
0e015974ca fix(library/unifier): bug in process_flex_rigid, also cleanup the code and break it into different cases
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-28 11:19:56 -07:00
Leonardo de Moura
7075f6e94a fix(library/module): make sure decls from imported modules have module_idx > 0
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-28 08:36:54 -07:00
Leonardo de Moura
58b6169e8b fix(library/max_sharing): take binder annotations into account
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-28 08:31:09 -07:00
Leonardo de Moura
e408998e06 fix(library/tactic): name convention
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-27 18:42:59 -07:00
Leonardo de Moura
fa72e7b874 refactor(library/tactic): simplify tactic
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-27 18:35:59 -07:00
Leonardo de Moura
5524c6c3d8 refactor(library/tactic/proof_state): simplify proof state
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-27 14:49:48 -07:00
Leonardo de Moura
c6ac89d967 refactor(library/tactic/proof_builder): simplify proof builder
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-27 12:25:04 -07:00
Leonardo de Moura
aaa7960b75 refactor(library/tactic/goal): use local names for hypotheses
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-27 11:11:12 -07:00
Leonardo de Moura
d84b745241 refactor(library/tactic/cex_builder): simplify cex_builder
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-27 07:14:33 -07:00
Leonardo de Moura
b4e4c4d610 chore(library/tactic): remove unnecessary file
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-27 07:02:13 -07:00
Leonardo de Moura
f1d8d8dcf9 chore(library/tactic): update goal objects
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-27 07:00:12 -07:00
Leonardo de Moura
ad70044ae1 chore(library/tactic): remove dead code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-27 07:00:12 -07:00
Leonardo de Moura
e55b4bf86d fix(library/unifier): bug in flex_rigid case: binding imitation
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 20:43:49 -07:00
Leonardo de Moura
50e21586b0 feat(library/unifier): do not create a case-split for choice constraints that produce only one alternative
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 18:52:13 -07:00
Leonardo de Moura
ed299c0914 feat(library/coercion): add has_coercions_to function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 18:38:27 -07:00
Leonardo de Moura
e769121c2a fix(frontends/lean/elaborator): memory leaks that only occur when compiling with clang++
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 16:02:54 -07:00
Leonardo de Moura
150d285b39 fix (library/unifier): occurs_context_check
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 14:45:36 -07:00
Leonardo de Moura
16bdc51fc4 refactor(kernel/type_checker): simplify type checker API, and remove add_cnstr_fn
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 13:36:31 -07:00
Leonardo de Moura
5e0e737213 feat(library/scoped_ext): do not import 'children' namespace objects
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 10:32:34 -07:00
Leonardo de Moura
6085a54416 feat(library/error_handling): improve unifier_exception error message
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 08:49:50 -07:00
Leonardo de Moura
e735a8e5ff fix(library/unifier): bug in conflict resolution
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 08:42:40 -07:00
Leonardo de Moura
52ff29a6f7 feat(frontends/lean): add 'coercion' command
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 08:08:39 -07:00
Leonardo de Moura
acf8c13619 feat(kernel): add strict implicit arguments
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 17:50:49 -07:00
Leonardo de Moura
a42a80407a fix(library/unifier): when imitating (f a), abstract local constants occurring in f
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 16:11:31 -07:00
Leonardo de Moura
f981a4c1fe fix(library/unifier): bug in lambda_abstract_locals auxiliary function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 09:59:08 -07:00
Leonardo de Moura
6db6048bf8 feat(library/error_handling): pretty print unifier exceptions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 09:41:25 -07:00
Leonardo de Moura
18a883ab1b fix(library/unifier): set conflict if type mismatch during metavariable assignment
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 09:33:34 -07:00
Leonardo de Moura
d055c4880f feat(frontends/lean): connect new elaborator to frontend
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 08:31:00 -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
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
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
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
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
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
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
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
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
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
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
05d1832425 refactor(kernel/type_checker): improve ensure_pi and ensure_sort APIs
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-19 22:33:58 -07:00
Leonardo de Moura
77c5319c4a chore(*): remove Lua 'migrate'
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-18 07:01:34 -07:00
Leonardo de Moura
3ea24c0f32 fix(library/kernel_bindings): set_environment and set_io_state objects
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-17 22:36:47 -07:00
Leonardo de Moura
f9d81c24d3 feat(library/expr_lt): add lex comparison for expression pairs
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-17 12:14:22 -07:00
Leonardo de Moura
0779db7ae9 fix(kernel): set module_idx on theorems, otherwise we are not able to import theorems that use opaque definitions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 16:56:11 -07:00
Leonardo de Moura
2c4175341c feat(library/placeholder): allow types to be attached to placeholders
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 14:35:55 -07:00
Leonardo de Moura
07f2379dec refactor(kernel): add mk_local function that has only two arguments
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 14:27:26 -07:00
Leonardo de Moura
e7019ec840 feat(frontends/lean): add infixl/infixr/postfix/precedence commands, add support for storing notation in .olean files, add support for organizing notation into namespaces
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-14 22:13:25 -07:00
Leonardo de Moura
a65c43c0db feat(frontends/lean/builtin_cmds): add definition command family
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-13 17:30:35 -07:00
Leonardo de Moura
01cecb76db feat(frontends/lean/builtin_cmds): add 'variable' command family
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-13 15:13:50 -07:00
Leonardo de Moura
ce259e6265 feat(frontends/lean/parser): add namespace/section/end commands, add support for explicit universe levels, fix Type notation'
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-13 11:34:43 -07:00
Leonardo de Moura
5aca452439 feat(library/aliases): add 'exceptions' and support for universes to add_aliases procedure, add for_each_universe method to environment
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-13 08:26:05 -07:00
Leonardo de Moura
a914345d29 feat(library): new scoping framework
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-12 19:33:02 -07:00
Leonardo de Moura
d50376249f feat(library/aliases): add level aliases
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-12 12:35:02 -07:00
Leonardo de Moura
1c5d3295cc refactor(library/deep_copy): use replace to implement deep_copy
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-11 14:35:34 -07:00
Leonardo de Moura
4f83b1a50b feat(library): add choice expressions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-11 14:35:34 -07:00
Leonardo de Moura
431b47377d feat(library/kernel_bindings): add 'set_env/set_environment' commands for updating the global environment
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-11 11:03:12 -07:00
Leonardo de Moura
637eae40ad feat(library/aliases): add support for alias overloading
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-10 10:05:51 -07:00
Leonardo de Moura
439b6c1e96 feat(frontends/lean/parse_table): add parse_table Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-09 15:33:39 -07:00
Leonardo de Moura
1c49b4d85f chore(*): replace unique_lock with lock_guard when we do not need to use conditional variables
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-07 20:55:25 -07:00
Leonardo de Moura
7124866a4f fix(library/module): potential deadlock when child thread threw an exception
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-07 20:34:18 -07:00
Leonardo de Moura
15f0899efb refactor(*): replace LEAN_THREAD_LOCAL with MK_THREAD_LOCAL_GET, the new macro uses the Boost thread_local_ptr instead of 'thread_local' directive
Motivation: clang++ on OSX does not support 'thread_local'.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-07 10:18:36 -07:00
Leonardo de Moura
c1796d0ce4 chore(*): remove dead code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-06 10:35:17 -07:00
Leonardo de Moura
4cf1b05831 refactor(library/token_set): move to frontends/lean
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-05 13:10:50 -07:00
Leonardo de Moura
70c3ae8692 feat(library/token_set): register builtin commands
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-05 13:05:40 -07:00
Leonardo de Moura
5b898aa3ed refactor(util/trie): modify interface to avoid the creation of many temporary optional values and inc/dec reference counters
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-05 12:40:51 -07:00
Leonardo de Moura
220f94d36e feat(library/kernel_bindings): expose instantiate_levels
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-04 16:26:26 -07:00
Leonardo de Moura
1c96373c1a feat(library/kernel_bindings): expose replace_fn in the Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-04 15:26:55 -07:00
Leonardo de Moura
4a25e7442a feat(kernel/expr): add optional expression caching (aka "partial" hash-consing)
We do not enforce full hash-consing because we would need to synchronize
the access to the hashtable/cache.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 15:35:47 -07:00
Leonardo de Moura
45a3ab5141 refactor(library/aliases): it is bad design to instantiate parameter using the parameter name, the parameter names have no semantic value
Moreover, we could create type incorrect aliases by "accident".

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 15:20:14 -07:00
Leonardo de Moura
1f6cfce05c refactor(library/placeholder): use different names for different placeholders, it is bad design to assume that two structurally identical expressions are different when they are allocated twice (this design is not compatible with any form of hash-consing
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 14:59:00 -07:00
Leonardo de Moura
076414693a feat(library/kernel_bindings): improve argument validation in the Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 10:17:12 -07:00
Leonardo de Moura
7dba2c29d2 feat(library): add token set
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 02:34:12 -07:00
Leonardo de Moura
ab5f570924 refactor(kernel/constraint): remove choice constraints from the kernel, the kernel does not use them, we will implement them in elaborator
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 00:46:28 -07:00
Leonardo de Moura
045fa911d1 fix(library/kernel_bindings): missing kind in lean_kind
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 18:12:02 -07:00
Leonardo de Moura
ab7469c175 fix(library/scope): warning message, and old comment
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 18:08:46 -07:00
Leonardo de Moura
1467bb256e chore(library): remove unnecessary code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 16:22:38 -07:00
Leonardo de Moura
33bbcd9526 chore(kernel/declaration): rename declaration::get_params to declaration::get_univ_params
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 16:20:34 -07:00
Leonardo de Moura
82e1f87e08 feat(kernel): add function param_names_to_levels
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 16:17:04 -07:00
Leonardo de Moura
712c10f818 fix(library/scope): make sure the local universe names do not conflict with universe parameter names when close a section, add declaration parameter name sanitizers
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 15:39:57 -07:00
Leonardo de Moura
f82658f213 feat(library): add helper functions for 'updating' declarations
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 15:13:38 -07:00
Leonardo de Moura
dcacf6fbca refactor(util): rename name_map to name_hash_map
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 14:34:22 -07:00
Leonardo de Moura
b6d2328c1d fix(library/scope): make sure local levels are added in the beginning of the universe parameter list
The idea is to make sure it is consistent with the behavior used for regular local parameters.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 14:06:31 -07:00
Leonardo de Moura
9b6b162a7c fix(library/scope): bug when abstracting inductive declaration in the end of a section
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 13:46:16 -07:00
Leonardo de Moura
6ee272477a fix(library/private): bug when preserving private names at end_section
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 11:32:14 -07:00
Leonardo de Moura
936ca80b9b fix(library/scope): bug in add_definition
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 11:04:34 -07:00
Leonardo de Moura
e56307f006 fix(library/scope): bug in end_scope procedure
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 10:43:28 -07:00
Leonardo de Moura
6e113206b6 feat(library/scope): add support for inductive datatypes in sections
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 10:28:07 -07:00
Leonardo de Moura
d36ef5dcbe feat(library/private): preserve 'hidden/private name => user name' map when section is closed
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-01 18:09:11 -07:00
Leonardo de Moura
585f3adde1 feat(library/scope): add sections
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-01 17:55:11 -07:00
Leonardo de Moura
286d7f0e64 feat(library): add namespace management
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-31 15:41:01 -07:00
Leonardo de Moura
3145cee51f refactor(library/aliases): move replace_prefix to util/name
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-31 15:11:22 -07:00
Leonardo de Moura
f7b3061a66 feat(library/module): improve 'import module' error messages
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-31 12:52:06 -07:00
Leonardo de Moura
75abcea83f fix(library/kernel_bindings): Lua API consistency, environment:add method also register declaration in the export table
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-31 12:20:57 -07:00
Leonardo de Moura
7bd10c2d2d feat(library/module): export global universe level declarations
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-31 12:12:41 -07:00
Leonardo de Moura
1b5366cfb7 feat(library): add module for implementing aliases and 'using' command
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-30 21:42:40 -07:00
Leonardo de Moura
6902d8cb05 feat(library): add simple placeholder module
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-30 20:28:28 -07:00
Leonardo de Moura
72f9e26dab refactor(library/private): add hidden_to_user_name and user_to_hidden_name functions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-30 17:52:01 -07:00
Leonardo de Moura
128d668f03 feat(library): add support for creating 'private/hidden' names
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-29 18:37:09 -07:00
Leonardo de Moura
13f9db26b7 refactor(library): add module namespace
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-29 13:58:47 -07:00
Leonardo de Moura
fc7d5461b1 feat(library/kernel_bindings): add to_io_state_ext helper function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-29 13:35:11 -07:00
Leonardo de Moura
f8e71f711f feat(library/expr_lt): add expr_quick_cmp functional object
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-29 13:34:16 -07:00
Leonardo de Moura
bfa9b90af0 feat(library/kernel_bindings): used 'named' parameters in import_modules API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-29 11:03:44 -07:00
Leonardo de Moura
ade5d99023 feat(library/modules): add option for discarding the proof of imported theorems (after checking them)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-29 10:56:28 -07:00
Leonardo de Moura
28b9d17a14 perf(library/module): do not use multiple threads when skipping type checking, add flag to disable/enable type checking theorems asynchronously
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-28 10:04:42 -07:00
Leonardo de Moura
e206fcc1af perf(kernel/type_checker): reduce the overhead of creating delayed_justification objects, a huge number of them is created when type checking applications
We reduce the cost by avoiding the allocation of std::functional objects, and the unnecessary increment/decrement of reference counters.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-27 23:16:52 -07:00
Leonardo de Moura
6129cccc66 perf(library/shared_environment): replace shared_mutex with simple mutex, the shared_mutex is just overhead and impacts negatively on performance tests
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-27 08:34:44 -07:00
Leonardo de Moura
75117bede8 fix(library/kernel_bindings): use standard environment in import_modules
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-26 15:54:08 -07:00
Leonardo de Moura
eca906b074 feat(library/module): add inductive decls to .olean files
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-26 15:38:09 -07:00
Leonardo de Moura
49e1f78a33 feat(library/kernel_serializer): add serializer/deserializer for inductive decls
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-26 15:37:53 -07:00
Leonardo de Moura
2d31c6c0b2 feat(library/coercion): improve get_user_coercions API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 11:35:47 -07:00
Leonardo de Moura
e058839d24 fix(library/coercion): allow cycles in the coercion graph
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 11:08:49 -07:00
Leonardo de Moura
71b555ab15 test(lua): coercion module error messages
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 10:01:04 -07:00
Leonardo de Moura
ef14c3d67e fix(library/coercion): coercion replacement
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 09:49:26 -07:00
Leonardo de Moura
eb6d72a20c fix(library/coercion): typo
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 08:55:20 -07:00
Leonardo de Moura
fc1819aadd test(lua): coercion serialization
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 08:38:50 -07:00
Leonardo de Moura
f598c6a110 fix(library/coercion): bug in coercion to function-class
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 08:21:53 -07:00
Leonardo de Moura
118eae2733 fix(library/coercion): bug add_coercion
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 07:45:49 -07:00
Leonardo de Moura
e9e61fec51 feat(library/coercion): add for_each_coercion procedure
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 07:45:49 -07:00
Leonardo de Moura
a408883c92 fix(library/coercion): bug in de-Bruijn indices
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 07:45:49 -07:00
Leonardo de Moura
1ee6bb48fc fix(library/coercion): bug in add_coercion_trans
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 06:25:31 -07:00
Leonardo de Moura
6536232107 feat(library/coercion): expose coercion module in the Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 06:05:31 -07:00
Leonardo de Moura
2be9bcef78 feat(library/coercion): add coercion management implementation
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-24 19:28:42 -07:00
Leonardo de Moura
1cff37a084 feat(library/module): use io_state to report warning messages
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-24 14:08:15 -07:00
Leonardo de Moura
5df2331159 feat(library/io_state): add constructor for copying io_state, but replacing channels
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-24 13:51:39 -07:00
Leonardo de Moura
f8255ddac6 fix(library/module): deadlock
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-23 16:46:53 -07:00
Leonardo de Moura
d30c600eb2 fix(library/module): bug in module import
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-23 16:23:47 -07:00