Commit graph

944 commits

Author SHA1 Message Date
Leonardo de Moura
955d7d2659 fix(library/aliases): namespace and constant have the same name, and 'using' produces the 'empty' alias
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-07 08:32:21 -07:00
Leonardo de Moura
2c3737bcc6 feat(frontends/lean): add info_manager
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-06 15:25:28 -07:00
Leonardo de Moura
da616f69ea perf(library/unifier): do not explore branches that will trigger type errors
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-05 20:16:16 -07:00
Leonardo de Moura
bbc4380a52 fix(library/unifier): bug exposed by recent changes
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-05 19:02:30 -07:00
Leonardo de Moura
9cc2015caa feat(library/unifier): better error message for invalid local context
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-05 16:25:22 -07:00
Leonardo de Moura
d1924097d5 feat(library/match): add 'local' backtracking
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-05 10:09:00 -07:00
Leonardo de Moura
e6ffda0c51 feat(library/match): add basic match_plugin that just invokes whnf before failing
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-05 08:37:03 -07:00
Leonardo de Moura
f4031b620f feat(library/match): extend match_plugin interface, and allow them to recursively invoke the matcher
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-04 18:30:30 -07:00
Leonardo de Moura
c34c2f4f5c feat(library/match): match universe levels
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-04 18:30:30 -07:00
Leonardo de Moura
b0a5ff7f93 refactor(library): rename hop_match to match
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-04 18:30:30 -07:00
Leonardo de Moura
0d5e346143 fix(library/expr_lt): make sure the builtin order is AC-compatible
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-04 15:51:10 -07:00
Leonardo de Moura
d5bb7d45ec fix(library/unifier): constraint priority in the unifier, and remove hack from if.lean
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-04 13:58:47 -07:00
Leonardo de Moura
552be37d48 feat(library/hop_match): port higher-order (pattern) matcher to Lean 0.2, we still have to implement support for universe levels
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-03 16:03:58 -07:00
Leonardo de Moura
2dca68e645 chore(util/list): add inline functions for commonly used patterns in list processing code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-03 13:51:38 -07:00
Leonardo de Moura
50b0c17092 feat(library/unifier): add more information in error messages due to type errors when assigning metavariables
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-03 09:49:30 -07:00
Leonardo de Moura
4b030c5d5f feat(library/module): relative module path
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-02 19:47:55 -07:00
Leonardo de Moura
fbc4a7af3b feat(library/unifier): when unifier.expensive == true, then use only restrict higher-order unification (a fragment slightly more general than higher-order pattern matching) for solving class-instance constraints
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-02 14:30:25 -07:00
Leonardo de Moura
5e2185cfbe feat(library/unifier): postpone as much as possible universe constraints of the form ?m1 =?= max(l1, l2) and ?m1 =?= imax(l1, l2) where ?m1 occurs in the right hand side. When there is nothing else to be done, try to solve them by reducing to ?m1 = l1 and ?m1 = l2.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-02 09:14:35 -07:00
Leonardo de Moura
52e3505599 feat(frontends/lean): display warning message when importing file that uses 'sorry'
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-02 00:47:58 -07:00
Leonardo de Moura
53833c70e9 fix(library/coercion): spurious 'replacing coercion', fixes #22
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-01 21:45:37 -07:00
Leonardo de Moura
8bd36dabce refactor(kernel/pos_info_provider): get_pos_info return none if position is not available
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-01 20:17:26 -07:00
Leonardo de Moura
f39b2eb70f feat(frontends/lean): add --flyinfo option
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-31 19:54:21 -07:00
Leonardo de Moura
9cf93c8299 feat(library/error_handling): add helpers classes for creating WARNING and INFO annotations for flycheck
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-31 17:41:39 -07:00
Leonardo de Moura
de05c041c7 feat(library/unifier): add flag for enabling/disabling expensive extensions in the unifier
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-31 16:46:16 -07:00
Leonardo de Moura
f57fc33442 fix(library/unifier): bug that was making unifier miss solutions, and add a new case-split that tries to solve flex_rigid constraints by putting the rhs into whnf
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-31 16:46:16 -07:00
Leonardo de Moura
92e90fbd07 feat(library/error_handling): add flycheck_scope helper class
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-31 12:45:54 -07:00
Leonardo de Moura
1a8a2b0811 refactor(library/unifier): process_flex_rigid method before adding yet another case split
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-31 12:25:35 -07:00
Soonho Kong
14a406d4d7 feat: add "--flycheck" option to print out error msgs for flycheck 2014-07-31 11:18:51 -07:00
Leonardo de Moura
450131692a fix(library/converter): missing constraint on eta expansion
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-30 10:43:47 -07:00
Leonardo de Moura
936bb2744b fix(library/unifier): add a flag to sign that a choice constraint owns a metavariable ?m, that is, it has the right to assign ?m, and the unifier should postpone any other constraint that tries to assign ?m
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-29 17:32:55 -07:00
Leonardo de Moura
7df78ea503 feat(kernel): add combinator for combining normalizer_extensions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-29 10:00:40 -07:00
Leonardo de Moura
105c29b51e refactor(library/standard): use new coding style, rename bool.b0 and bool.b1 to bool.ff and bool.tt
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-28 19:59:38 -07:00
Leonardo de Moura
864fdd37da refactor(library/aliases): aliases are from name to names
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-27 21:01:59 -07:00
Leonardo de Moura
d1fe1286c0 fix(library/unifier): bug introduced today in consume_tc_cnstrs
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-27 17:16:30 -07:00
Leonardo de Moura
faee08591f fix(*): make sure elaborator and type_checker use the same "rules" for treating opaque definitions
This is a big change because we have to store in constraints whether we can use the "relaxed" rules or not.
The "relaxed" case says that when type checking the value of an opaque definition we can treat other opaque definitions in the same module as transparent.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-27 12:12:54 -07:00
Leonardo de Moura
cb232f2a9b fix(kernel/inductive): use has_expr_metavar_strict instead of has_expr_metavar
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-26 19:57:54 -07:00
Leonardo de Moura
23af5ab217 fix(library/unifier): eager whnf application
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-26 10:37:02 -07:00
Leonardo de Moura
556861c8d6 fix(library/unifier): remove incorrect assertion
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-26 07:52:10 -07:00
Leonardo de Moura
70c887a0bd fix(library/unifier): fix cryptic error message
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-25 21:10:32 -07:00
Leonardo de Moura
01cec1e1f1 fix(library/unifier): more bugs in the unifier
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-25 20:05:37 -07:00
Leonardo de Moura
cf44c80ffb fix(library/inductive_unifier_plugin): do not try to solve type incorrect constraints
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-25 16:00:38 -07:00
Leonardo de Moura
7b84503133 fix(library/unifier): do not let a unification plugin to 'prioritize' a flex-flex constraint, and add missing case
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-25 15:03:57 -07:00
Leonardo de Moura
0f12e5a35b fix(library/inductive_unifier_plugin): unification problem failure on problems with inductive datatypes
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-25 13:49:45 -07:00
Leonardo de Moura
022a151cf7 feat(kernel): add general purpose 'annotations', they are just a generalization of the 'let'-annotations
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-25 09:33:31 -07:00
Leonardo de Moura
48b902dc37 feat(library/unifier): solve constraints of the form '(max l1 l2) =?= 0' and '(imax l1 l2) =?= 0'
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-24 20:30:51 -07:00
Leonardo de Moura
a533bf29da fix(library/unifier): broken optimization was missing solution
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-24 17:41:22 -07:00
Leonardo de Moura
2eb84c5f74 fix(library/unifier): make sure we do not miss dependency
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-24 11:38:43 -07:00
Leonardo de Moura
314c0822de fix(library/unifier): bugs exposed by recent changes
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-23 17:31:07 -07:00
Leonardo de Moura
13fe28dd1c perf(library/unifier): delay the instantiation of metavariables occurring in the types of local constants
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-23 14:31:30 -07:00
Leonardo de Moura
35481cb045 fix(library/unifier): potentially changing flag from l_false ==> l_undef
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-23 10:59:53 -07:00
Leonardo de Moura
301c395e59 perf(kernel/metavar): performance problem with occurs method
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-23 10:35:27 -07:00
Leonardo de Moura
61661478ad refactor(kernel/metavar): simplify substitution class, and remove dead code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-23 10:03:03 -07:00
Leonardo de Moura
75005765d6 perf(library/unifier): add small performance improvement
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-22 17:58:40 -07:00
Leonardo de Moura
697bcf4b4f perf(library/unifier): improve performance of instantiate_meta method
It provides a significant performance boost in some files.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-22 16:24:07 -07:00
Leonardo de Moura
b522ea6f2d refactor(library/standard): rename bit to bool
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-22 09:49:54 -07:00
Leonardo de Moura
5eaf04518b refactor(*): rename Bool to Prop
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-22 09:43:18 -07:00
Leonardo de Moura
de657e8df0 fix(util/rc): reference counter memory_order flags
See discussion at
http://www.chaoticmind.net/~hcb/projects/boost.atomic/doc/atomic/usage_examples.html#boost_atomic.usage_examples.example_reference_counters
http://stackoverflow.com/questions/10268737/c11-atomics-and-intrusive-shared-pointer-reference-count

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-21 08:23:01 -07:00
Leonardo de Moura
cff6bf8c6d fix(library/module): sign error is circular module dependency is detected
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-20 19:21:54 -07:00
Leonardo de Moura
ba9dd8b686 fix(library/choice): style
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-21 01:36:53 +01:00
Leonardo de Moura
438a42d010 feat(library/unifier): improve error message when metavar assignment is type incorrect
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-20 00:19:32 +01:00
Leonardo de Moura
55db3aaaa1 fix(library/module): module index assignment
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-20 00:19:31 +01:00
Leonardo de Moura
c1b7d7bf7e fix(library/choice): we should be able to store 'choice' operators in .olean files, this can happen because of notation decls
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-20 00:19:31 +01:00
Leonardo de Moura
d69db172a1 chore(kernel/replace_fn): add syntax sugar for replace function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-19 12:53:37 +01:00
Leonardo de Moura
6b60db7b93 fix(frontends/lean/elaborator): bug when mixing implicit arguments and sections
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-19 09:55:34 +01:00
Leonardo de Moura
a78fb8f013 perf(library/unifier): minimize the number of constraints generated in the flex_rigid 'imitation' step
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-17 06:32:21 +01:00
Leonardo de Moura
6ddba9c276 fix(library/unifier): bug in process_delta
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-16 04:55:09 +01:00
Leonardo de Moura
c8849d42e9 fix(library/unifier): tolerate exceptions in the type_checker::infer method. This can happen since when we try projections we don't check whether they are type correct
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-16 03:05:19 +01:00
Leonardo de Moura
bd0cc5c365 fix(library/expr_pair): typo
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-15 04:11:27 +01:00
Leonardo de Moura
a18cf94d09 perf(library/unifier): minimize the use of instantiate_metavars
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-15 03:55:27 +01:00
Leonardo de Moura
29c7eeaa99 refactor(library/unifier): improve occurs_context_check
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-15 02:08:16 +01:00
Leonardo de Moura
2e6184a721 fix(frontends/lean): more bugs in section management
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-14 06:27:36 +01:00
Leonardo de Moura
5c51be4585 refactor(frontends/lean): use expr_struct_set when collecting locals
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-14 04:12:58 +01:00
Leonardo de Moura
fab7934265 refactor(frontends/lean/elaborator): modify when tactic_hints are invoked, add the notion of strict placeholder
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-14 02:53:02 +01:00
Leonardo de Moura
614d8a768b fix(library/unifier): flex_rigid case (?M ...) =?= (f ...), where f is not a constant nor a local
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-13 02:46:04 +01:00
Leonardo de Moura
6d95250d4b fix(library/kernel_serializer): make sure temporary (internal) binder names do not leak into .olean files
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-12 20:23:38 +01:00
Leonardo de Moura
391e5e2bc2 perf(library/unifier): use d_instantiate_metavars
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-12 05:12:09 +01:00
Leonardo de Moura
9517f31a71 refactor(kernel/metavar): remove unnecessary functionality
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-12 04:45:50 +01:00
Leonardo de Moura
50f76fd138 perf(library/unifier): improve m_mvar_occs management
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-12 04:23:02 +01:00
Leonardo de Moura
c3e8e83e50 perf(library/unifier): simple optimization
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-11 20:21:41 +01:00
Leonardo de Moura
1230e942aa feat(library/unifier): handle 'first-order' flex-flex constraints
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-11 04:51:28 +01:00
Leonardo de Moura
b62abf0f06 refactor(library/tactic/goal): remove redundance, goal pp method was duplicating some of the functionality provided by the pretty printer
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-10 18:59:03 +01:00
Leonardo de Moura
405e57eb2d refactor(kernel/formatter): add formatter_factory, and simplify formatter interface
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-10 18:32:00 +01:00
Leonardo de Moura
2ef7b9be2f feat(frontends/lean): add basic pretty printer
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-09 01:12:36 -07:00
Leonardo de Moura
91b0dcad0f fix(library/tactic): avoid 'unknown' message in trace_tac when position information is not available
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-08 17:48:41 -07:00
Leonardo de Moura
a1601e7a5f feat(library/tactic/apply_tactic): add option for 'refreshing' universe metavariables in the 'apply' tactic
The new test ../../tests/lean/run/tactic27.lean demonstrates why we need this feature. The tactic 'apply @refl' is actually 'apply @refl.{?l}'. It is used inside of a repeat tactical. Each iteration of the 'repeat' may need to use a different value for ?l. Before this commit, there was not way to say we want a fresh ?l each iteration.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-08 16:55:23 -07:00
Leonardo de Moura
547ca9b3c4 fix(library/inductive_unifier_plugin): missing test
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-08 16:39:39 -07:00
Leonardo de Moura
a3be63af73 feat(frontends/lean): add tactic_hint command
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-08 15:08:13 -07:00
Leonardo de Moura
33cb2db5b5 feat(library/head_map): a simple indexing datastructure
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-08 15:08:13 -07:00
Leonardo de Moura
b43fb7448c feat(frontends/lean): search for identifiers in the stack of namespaces; reject non-atomic names as local names
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-07 19:00:06 -07:00
Leonardo de Moura
e6d4c01b88 feat(frontends/lean): check whether namespace exists or not in the 'using' command, add to_valid_namespace_name helper function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-07 18:17:10 -07:00
Leonardo de Moura
c16951aba6 fix(library/aliases): aliasing behavior
The new test '../../tests/lean/run/alias3.lean' demonstrates the issue being fixed.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-07 15:40:55 -07:00
Leonardo de Moura
6ceecf6a15 feat(library/aliases): remove duplicates from aliasing tables
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-07 12:59:57 -07:00
Leonardo de Moura
b956ce68d2 feat(frontends/lean/elaborator): keep postponing delayed coercions until the type can be inferred
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-07 12:50:43 -07:00
Leonardo de Moura
fe448d47be feat(library/unifier): improve failure report
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-07 12:03:37 -07:00
Leonardo de Moura
48b28ad75c fix(library/unifier): missing test in flex_rigid
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-06 21:36:23 -07:00
Leonardo de Moura
dcf7cf00ff fix(*): bugs in the type checker, inductive datatypes, and unifier
The bugs were indentified when performing the tiny change in the file
tests/lean/run/group.lean
2014-07-06 18:44:56 -07:00
Leonardo de Moura
9be1a4ab46 fix(library/module): module index assignment
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-05 23:32:18 -07:00
Leonardo de Moura
55894f01e3 feat(frontends/lean): add 'opaque_hint' command
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-05 18:58:20 -07:00
Leonardo de Moura
59755289e4 feat(library/unifier): case split on constraints of the form (f ...) =?= (f ...), where f can be unfolded, and there are metavariables in the arguments
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-05 15:52:40 -07:00
Leonardo de Moura
8aa217ea76 chore(library/unifier): update comments
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-05 11:06:13 -07:00