Commit graph

2913 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
246d71f3ff feat(library/equations_compiler): error recovery 2017-07-16 05:17:38 -07:00
Gabriel Ebner
9367e94900 fix(frontends/lean/pp): hide proof terms in non-proofs by default
This is mainly to reduce clutter.  Proof term printing can still be
forced using the `pp.proofs` option.
2017-07-15 22:21:22 +01:00
Gabriel Ebner
37d9e03cc1 feat(frontends/lean/pp): show substituted expressions for delayed abstractions
@leodemoura I tried to look up the unique names in the local context,
but this pretty much always fails.  AFAICT we never remember the local
context when pretty-printing expression texts.
2017-07-15 21:34:05 +01:00
Gabriel Ebner
68ee9396c6 fix(frontends/lean/parser): support backtracking from empty expressions
Fixes #1745.
2017-07-15 11:12:09 +01:00
Gabriel Ebner
3392aa90b5 fix(frontends/lean/definition_cmds): support parameters in mutual defs 2017-07-13 15:14:46 +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
Gabriel Ebner
d610709a53 fix(frontends/lean/print_cmd): report error on unknown identifier 2017-07-06 19:58:30 +02:00
Leonardo de Moura
1bfaf19277 chore(library/delayed_abstraction): clarify delayed_abstraction API 2017-07-05 16:40:45 -07:00
Sebastian Ullrich
8ac1ea6b18 feat(frontends/lean/tactic_notation): ignore by keyword in interactive tactic mode 2017-07-05 11:20:10 -07:00
Sebastian Ullrich
c8d6b40991 refactor(frontends/lean/builtin_exprs,library): suppose ~> assume : 2017-07-05 11:20:10 -07:00
Sebastian Ullrich
f024ccd75d refactor(frontends/lean/token_table,library): take ~> assume 2017-07-05 11:20:10 -07:00
Sebastian Ullrich
f95f70fe56 feat(frontends/lean/builtin_exprs): support have ... := ... in term mode 2017-07-05 11:20:10 -07:00
Sebastian Ullrich
2f73a38637 refactor(frontends/lean/builtin_exprs): simplify parse_have 2017-07-05 11:20:10 -07:00
Sebastian Ullrich
2ca44459ba feat(init/meta/interactive): add from synonym for exact 2017-07-05 11:20:10 -07:00
Sebastian Ullrich
2b35a9b1f0 fix(frontends/lean/notation_cmd): notation: default binding power for leading tokens to max 2017-07-05 17:30:38 +02:00
Sebastian Ullrich
ad97607307 fix(frontends/lean/tactic_notation): always use quote_scope for parsing interactive parameters
Replace now redundant `qexpr` parser with `parser.pexpr`
2017-07-04 12:20:38 -07:00
Leonardo de Moura
95c7c697a6 refactor(library/tactic/simp_lemmas): simp set generation should not be affected by transparency setting 2017-07-01 12:54:37 -07:00
Sebastian Ullrich
3cdf502c58 fix(frontends/lean/pp): escape keyword-like identifiers 2017-07-01 10:38:15 -07:00
Gabriel Ebner
ade83128f0 fix(frontends/lean/interactive): go-to-definition for relative imports
Fixes leanprover/vscode-lean#58.
2017-06-30 09:20:33 +02:00
Leonardo de Moura
adcb95626e feat(frontends/lean/tactic_notation): allow interactive tactics to take itactic arguments from a different tac_class 2017-06-28 14:51:42 -07:00
Leonardo de Moura
0b19ef82e1 feat(frontends/lean/structure_cmd): default parameter for structure/class declarations
Remark: we support them at inductive declarations.
2017-06-28 12:20:56 -07:00
Sebastian Ullrich
08495eef27 refactor(init/meta,frontends/lean/tactic_notation): assume_tac -> «assume» etc.
Fixes the eldoc display.

Also allow arbitrary keywords as tactics
2017-06-28 10:43:19 -07:00
Sebastian Ullrich
f53fa97c4a feat(frontends/lean): escape identifiers when pretty-printing 2017-06-28 10:43:19 -07:00
Sebastian Ullrich
16fe494736 feat(frontends/lean/scanner): accept arbitrary escaped identifiers 2017-06-28 10:43:19 -07:00
Sebastian Ullrich
9033cba7d3 feat(frontends/lean,init/meta/interactive): assume and suppose tactics 2017-06-27 18:50:10 -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
Gabriel Ebner
33679a11b9 feat(shell/lean,util/log_tree): show currently executing task in lean --make
@dselsam @johoelzl This should make it easier to diagnose which proofs
time out or take a very long time.
2017-06-27 18:48:25 +02:00
Leonardo de Moura
f339f97975 fix(frontends/lean/brackets): fixes #1703 2017-06-26 12:52:52 -07:00
Leonardo de Moura
41a1faa131 fix(frontends/lean/elaborator): check resulting type at visit_convoy 2017-06-25 10:50:40 -07:00
Gabriel Ebner
ed27334557 refactor(frontends/lean/scanner): use uchar for scanning 2017-06-25 10:06:29 +02:00
Gabriel Ebner
31162df650 fix(frontends/lean/structure_instance): compiler warning 2017-06-23 08:31:04 +02:00
Leonardo de Moura
e63c79c81e feat(frontends/lean): enable hash_consing during tactic execution
This commit is trying to address a memory consumption problem in
@dselsam project.
2017-06-22 17:24:27 -07:00
Leonardo de Moura
096b437c11 fix(library/equations_compiler, frontends/lean): missing operator== for macro_definition_cell subclasses 2017-06-22 16:13:29 -07:00
Mario Carneiro
09af93186a fix(frontends/lean/elaborator): @applications don't make thunks 2017-06-22 08:24:11 -07:00
Sebastian Ullrich
0a48809469 refactor(frontends/lean/tactic_notation): rename note/define tactics to have/let 2017-06-22 08:03:23 -07:00
Leonardo de Moura
eef4d95410 feat(frontends/lean/inductive_cmds): closes #1655 2017-06-20 16:25:18 -07:00
Leonardo de Moura
c7e68e57cf fix(frontends/lean/structure_cmd): fixes #1681
@kha I'm not sure if this is the right fix. I just avoided the loop that adds
`mk_expr_placeholder` if the function is not a projection.
I didn't spend time investigating why we need `mk_proj_app`.
I know the library doesn't compile if we don't use it, and just use
```
    return mk_app(copy_tag(ref, mk_constant(S_name + fname)), e);
```
:)
2017-06-19 16:22:38 -07:00
Leonardo de Moura
ddb6b38d88 fix(frontends/lean/elaborator): fixes #1682
@kha Could you please double check whether this is right fix?
2017-06-19 16:04:24 -07:00
Leonardo de Moura
0f64b6088c chore(frontends/lean): remove then have ... notation
This notation was a leftover from Lean 0.1.
2017-06-19 14:20:52 -07:00
Sebastian Ullrich
91c77680c8 refactor(init/meta/coinductive_predicates,frontends/lean/inductive_cmds): declare coinductive in Lean 2017-06-19 11:27:12 -07:00
Sebastian Ullrich
018ebdd115 feat(frontends/lean/user_command): add user-defined commands 2017-06-19 11:27:12 -07:00
Sebastian Ullrich
492cb20438 feat(init/meta/{interactive_base,parser}): decl_attributes, decl_meta_info, parser.set_env 2017-06-19 11:27:12 -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
Gabriel Ebner
95f8a50a03 fix(frontends/lean/scanner): use platform-independent end-of-file marker 2017-06-19 10:39:08 +02:00
Leonardo de Moura
dc1a1c8540 refactor(library): has_to_string ==> has_repr
See issue #1664

This is just the first step to implement proposal described at issue #1664.
2017-06-18 18:29:19 -07:00
Leonardo de Moura
c33fd8b0fd fix(frontends/lean/elaborator): fixes #1669 2017-06-18 16:14:48 -07:00
Leonardo de Moura
9b250a2fb8 fix(frontends/lean/interactive): hole_commands 2017-06-15 17:03:40 -07:00