Commit graph

648 commits

Author SHA1 Message Date
Sebastian Ullrich
9c2d42b269 fix(frontends/lean/parser): to_pattern_fn: replace invalid choice pattern with sorry
Fixes #1749
2017-07-17 14:59:07 +02:00
Leonardo de Moura
9afb53fad5 feat(kernel/expr): allow metavariables to have user-facing names
We need this feature for:
1) Defining nonlinear search patterns. Example: (?m <= ?m + 1)
2) Preprocessing recursive equations and support the pattern
refinement approach used in Agda. Example: in Agda, they accept
```
def append {A : Type} : Π (m n : nat), Vec A m -> Vec A n -> Vec A (m + n)
| m n nil            ys := ys
| m n (cons m' x xs) ys := cons x (append m' n xs ys)
```
These equations have to be refined. For example, `m` has to be
replaced with `0` (in the first equation), and `succ m'` in the
second. To implement this kind of refinement, we need to convert
the pattern variables (local constants) into metavariables during
elaboration. Then, the unassigned metavariables become local constants
again. This preprocessing step will fix some of the issues on #1594.
To completely fix #1594, we will need yet another preprocessing step
which will implement "complete transition" used in the equation
compiler before we start elim_match.cpp
2017-07-16 07:16:41 -07:00
Gabriel Ebner
68ee9396c6 fix(frontends/lean/parser): support backtracking from empty expressions
Fixes #1745.
2017-07-15 11:12:09 +01:00
Leonardo de Moura
8dcccd3bfc fix(frontends/lean/parser): make sure imax and max level arguments are parsed using the same precendence we use to parse application arguments
This commit addresses an issue raised by @digama0 on the Lean slack channel.
2017-07-07 12:43:07 -07:00
Sebastian Ullrich
2ca44459ba feat(init/meta/interactive): add from synonym for exact 2017-07-05 11:20:10 -07:00
Sebastian Ullrich
f53fa97c4a feat(frontends/lean): escape identifiers when pretty-printing 2017-06-28 10:43:19 -07:00
Leonardo de Moura
3300eafd39 fix(frontends/lean/parser): fixes #1705
This is a temporary fix.
We will be able to implement a better solution after #1674.
2017-06-27 13:20:37 -07:00
Leonardo de Moura
582aa3338b fix(frontends/lean): compilation warnings with older versions of gcc 2017-06-19 11:14:22 -07:00
Sebastian Ullrich
95b317fa64 refactor(frontends/lean): do not hard code commands accepting attributes & modifiers 2017-06-19 11:09:26 -07:00
Leonardo de Moura
bf0d785888 feat(library/messages, frontends/lean): optional end position for messages
We need this information to be able to fix issues with the transient
message boxes feature (#1667).
2017-06-15 10:47:58 -07:00
Johannes Hölzl
1352d4a5b3 feat(src/frontents/lean): support for coinduction command in frontend 2017-06-12 20:42:48 -07:00
Leonardo de Moura
748eb856c3 fix(frontends/lean): fixes #1649
This issue is yet another reason for refactoring how parameters are
represented in Lean.
2017-06-06 21:33:24 -07:00
Leonardo de Moura
56215b36e8 fix(*): [[fallthrough]] ==> /* fall-thru */
Older gcc compilers generate a warning when the attribute is used.
I found out that GCC 7 will not produce a warning if comments
such as /* fall-thru */ or /* FALLTHRU */ are used instead of the
attribute [[fallthrough]]
2017-05-31 21:18:47 -07:00
Leonardo de Moura
24048c4258 fix(*): gcc 7 weird uninitialized warnings
I think most of them are incorrect.
I didn't find a workaround for the one at json.hpp.
So, I just disabled this warning at server.cpp
2017-05-31 18:05:03 -07:00
Leonardo de Moura
919cf420ea fix(*): gcc 7 warnings 2017-05-31 16:35:09 -07:00
Gabriel Ebner
ce44566c7d fix(frontends/lean/parser): do not skip command tokens after error recovery 2017-05-23 11:14:31 -07:00
Gabriel Ebner
47629e9da3 feat(frontends/lean): make most parser_errors recoverable 2017-05-23 11:14:31 -07:00
Gabriel Ebner
183bf63e26 fix(frontends/lean/parser): pass error-recovery flag from parser to elaborator 2017-05-23 11:14:31 -07:00
Gabriel Ebner
6b956ad658 fix(frontends/lean): prevent endless loops 2017-05-23 11:14:30 -07:00
Gabriel Ebner
345cd1bc2a feat(frontends/lean/parser): error recovery in interactive tactics 2017-05-23 11:14:30 -07:00
Gabriel Ebner
8c80cb8fe9 feat(frontends/lean/equations_validator): report errors instead of
exceptions
2017-05-23 11:14:30 -07:00
Gabriel Ebner
00ac867ddf feat(frontends/lean/elaborator,library/sorry): suppress error message that mention synthetic sorrys 2017-05-23 11:14:30 -07:00
Gabriel Ebner
1468461c47 feat(frontends/lean): recover from many parser errors 2017-05-23 11:14:30 -07:00
Sebastian Ullrich
84997bf4de refactor(init/meta/expr): unify expr and pexpr 2017-05-17 10:38:12 -07:00
Sebastian Ullrich
8c0394b294 refactor(library,frontends/lean): separate expr and pexpr macros 2017-05-09 16:02:41 -07:00
Sebastian Ullrich
2825c5fbcc feat(frontends/lean/elaborator): elaborate ``(e) to type reflected e` if possible and add coercion reflected -> expr 2017-05-09 16:02:41 -07:00
Gabriel Ebner
d79909a1b8 refactor(util/lean_path): support leanpkg.path files 2017-05-01 14:11:38 -07:00
Gabriel Ebner
baa4c48f1f refactor(util/lean_path): explicitly pass around search path 2017-05-01 14:11:38 -07:00
Leonardo de Moura
5cef84709f refactor(library): avoid auxiliary definitions such as add/mul/le/etc
See Section "Other goodies" at
https://github.com/leanprover/lean/wiki/Refactoring-structures

This commit also improves the support for projections in the
unifier/matcher.

Now, we consider the extra case-split for projections.
Given a projection `proj`, and the constraint `proj s =?= proj t`, we need to try first `s =?= t` and if it fails, then try to reduce.
This is needed in the standard library because we now have constraints such as:
```
@has_le.le ?A ?s ?a ?b  =?=  @has_le.le nat nat.has_add x y
```
If we reduce the right hand side, we get the unsolvable constraint
```
@has_le.le ?A ?s ?a ?b  =?=  nat.le x y
```
Before this change, the constraint was `@le ?A ?s ?a ?b  =?=  @le nat nat.has_add x y`, and we already perform a case-split in this case.
Moreover, projections were eagerly reduced whenever possible.
The extra case-split generates a performance problem in several tests. For example `fib 8 = 34` was timing out.
I worked around this issue by performing the case-split only when the constraint contains meta-variables.
There are also minor issues. Example. `<` is notation for `has_lt.lt`, but `>` is for `gt`.
2017-05-01 08:52:19 -07:00
Gabriel Ebner
a7d58008ac fix(frontends/lean/parser): show exception message in import errors 2017-04-27 16:04:18 -07:00
Gabriel Ebner
489b3304bd fix(frontends/lean/parser): allow enabling profiler via set_option 2017-04-23 11:22:50 -07:00
Gabriel Ebner
9424e6fa24 refactor(frontends/lean/definition_cmds): make profiling threshold configurable 2017-04-23 11:22:41 -07:00
Gabriel Ebner
01a7efc007 fix(library/module_mgr): do not crash on missing imports
Fixes #1506.
2017-04-04 19:56:33 +02:00
Sebastian Ullrich
669c4130b1 fix(frontends/lean/builtin_expr): no field notation after @/@@ 2017-03-31 09:40:49 -07:00
Sebastian Ullrich
3c8e176fb0 fix(frontends/lean/interactive): fix info on new field notation 2017-03-31 09:40:49 -07:00
Sebastian Ullrich
add8836ab2 fix(frontends/lean/{elaborator,parser}): use position of '.' for field notation position
Note that flycheck will still highlight the entire word...
2017-03-31 09:40:49 -07:00
Sebastian Ullrich
b92af074c0 feat(kernel/pos_info_provider): add save_pos_info
Allows the elaborator to contribute new info locations
2017-03-31 09:40:48 -07:00
Leonardo de Moura
ad859817b1 feat(frontends/lean): allow local decls to shadow namespaces 2017-03-29 16:09:45 -07:00
Leonardo de Moura
71685e4dd6 feat(frontends/lean): add support for t.<id> and t.<idx> when t is a composite term
Replace `^.` with `.` in the stdlib
2017-03-28 17:47:49 -07:00
Leonardo de Moura
87932f1c56 feat(frontends/lean): change notation for inaccessible patterns
The following are accepted
 .(t)
 ._

We don't accept .t anymore because it will conflict with the field
access notation.
2017-03-28 16:09:15 -07:00
Leonardo de Moura
6183c7676e feat(frontends/lean): use . for field access 2017-03-28 15:29:54 -07:00
Leonardo de Moura
07c29c0779 chore(library/abstract_parser,frontends/lean/parser): remove dead code 2017-03-28 11:51:50 -07:00
Sebastian Ullrich
e63c1d3347 refactor(frontends/lean/info_manager): use pos_info 2017-03-27 14:01:19 -07:00
Gabriel Ebner
318910f99b refactor(frontends/lean/parser): store snapshots in a lazy async list 2017-03-27 14:00:53 -07:00
Gabriel Ebner
2c7b6fc48f fix(frontends/lean/parser): only show sorry warning once per import 2017-03-24 09:19:17 +01:00
Gabriel Ebner
7442aa0752 fix(frontends/lean/parser): better task description 2017-03-24 07:22:28 +01:00
Gabriel Ebner
a6f7f31e85 refactor(shell,emacs): handle different checking modes in server 2017-03-23 09:07:09 +01:00
Gabriel Ebner
c7ca21625c feat(util/log_tree): annotate nodes with detail levels 2017-03-23 09:03:43 +01:00
Gabriel Ebner
98f86ccabd chore(frontends/lean/parser): remove obsolete option 2017-03-23 09:01:00 +01:00
Gabriel Ebner
26ba9c23a7 refactor(util/task): add eager execution 2017-03-23 08:57:56 +01:00