Commit graph

3584 commits

Author SHA1 Message Date
Mario Carneiro
bae50f8ce6 fix(tests/lean): fix tests 2017-06-27 18:55:52 -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
6ba425da6a feat(library/init/meta/interactive): add apply_with interactive tactic
The new tactic allows us to set apply_cfg in interactive mode.
2017-06-27 18:37:13 -07:00
Leonardo de Moura
e971acabb0 feat(library/init/meta): handle auto_params and opt_params at apply tactic 2017-06-27 18:17:48 -07:00
Leonardo de Moura
cdec07fc81 feat(library/init/meta/interactive): address issue raised in comment at #1374
The example at
https://github.com/leanprover/lean/issues/1342#issuecomment-307912291
2017-06-27 16:45:21 -07:00
Leonardo de Moura
ac19b15169 fix(library/tactic/apply_tactic): remove unnecessary code from apply_tactic, and add tests for #1342
See issue #1342
2017-06-27 16:07:59 -07:00
Leonardo de Moura
9b03309d83 fix(library/equations_compiler): performance problem reported by @dselsam 2017-06-27 15:24:12 -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
5a2b7348f9 feat(library/tactic/apply_tactic): make apply tactic more robust
See issue #1342

Support for auto_param and opt_param have not been implemented yet.
2017-06-27 10:42:26 -07:00
Leonardo de Moura
68afd4194b fix(library/tactic/simplify): fixes #1659
@dselsam The method `try_user_congr` was leaking a temporary
meta-variable into the formula. The problem in the congruence lemma
```
dif_ctx_simp_congr :
  ∀ {α : Sort u_1} {b c : Prop} [dec_b : decidable b] {x : b → α} {u : c → α} {y : ¬b → α} {v : ¬c → α}
  (h_c : b ↔ c),
    (∀ (h : c), x (h_c.mpr h) = u h) →
    (∀ (h : ¬c), y ((not_iff_not_of_iff h_c).mpr h) = v h) → dite b x y = dite c u v
```
when the hypothesis `(∀ (h : c), x (h_c.mpr h) = u h)` is processed,
`h_c` is still unassigned. `h_c` was being assigned in a second
loop (the one that I deleted). Do you see any reason for having this
second pass? I think it is an optimization, we can skip the potentially
expensive
```
   expr hyp = finalize(m_ctx, rel, r_congr_hyp).get_proof();
   expr pf = local_factory.mk_lambda(hyp);
```
if the expression has not been simplified.
Anyway, I removed this code and merged both loops.
I don't think it should impact performance since we barely use custom
congruence lemmas.
2017-06-26 15:25:58 -07:00
Leonardo de Moura
f339f97975 fix(frontends/lean/brackets): fixes #1703 2017-06-26 12:52:52 -07:00
Daniel Selsam
d95b003c0b feat(init/meta/congr_tactic.lean): tactic to apply congruence rules 2017-06-26 09:17:53 -04:00
Leonardo de Moura
ce5ca79edf feat(library/init/meta): add type_check tactic
closes #1697
2017-06-25 15:26:32 -07:00
Mario Carneiro
d3d5982544 fix(init/meta/mk_dec_eq_instance): bug for dependent structures 2017-06-25 14:55:47 -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
16fb5ade58 fix(library/string): correctly escape non-printable characters
This also fixes a compiler warning on ARM, where `0 <= c` is always
true.
2017-06-23 20:39:41 +02:00
Gabriel Ebner
30a9217a78 feat(library/type_context): unfold lemmas in major premise of acc.rec 2017-06-22 08:33:11 -07:00
Mario Carneiro
47c3c0ba84 fix(tests/*): fix tests 2017-06-22 08:24:19 -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
Mario Carneiro
495093f6c0 fix(tests/run): fix tests 2017-06-22 08:03:23 -07:00
Leonardo de Moura
14d768ffa2 feat(library/init/meta/interactive): add simp_all tactic
@Armael I added the simp_all tactic. See new test for an example.
2017-06-21 20:43:56 -07:00
Leonardo de Moura
058d073cba feat(library/init/meta/interactive): allow user to write rw [f] to rewrite using the equational lemmas for f
The tactic succeeds if the expression can be rewritten using one of the
equational lemmas associated with `f`.

See discussion at #1680
2017-06-21 18:56:18 -07:00
Leonardo de Moura
51a28828d6 chore(tests/lean/interactive/info_tactic): fix test 2017-06-21 17:03:24 -07:00
Leonardo de Moura
b9dee04fdb feat(library/tactic/simplify): add single_pass simplifier option (default is false) 2017-06-21 16:41:54 -07:00
Leonardo de Moura
9fcb3ae4b5 feat(library/tactic/simplify): store proof for refl lemmas and use them in simp
Before this commit, simp would not silently apply refl-lemmas, and use
reflexivity. This strategy produces compact proofs but may generate
performance problems. For example, the new test timeouts without this
commit.

I believe a similar performance problem is affecting the Certigrad
project developed by @dselsam.
2017-06-21 16:21:11 -07:00
Mario Carneiro
e6f3c5cc22 fix(tests/lean/interactive/mk_input): strip \r from input files (win) 2017-06-21 08:53:11 +02:00
Leonardo de Moura
eef4d95410 feat(frontends/lean/inductive_cmds): closes #1655 2017-06-20 16:25:18 -07:00
Leonardo de Moura
5a07b3b27c test(tests/lean/run/1688): add test for PR #1688 2017-06-20 12:36:31 -07:00
Leonardo de Moura
b25291c5c9 fix(library/tactic/simplify): fixes #1685 2017-06-20 12:27:46 -07:00
Leonardo de Moura
ce3387b246 fix(library/tactic/change_tactic): fixes #1686 2017-06-20 12:05:21 -07:00
Leonardo de Moura
3c306d0a7b fix(library/equations_compiler/elim_match): forward dependency checking
See comment at #1594

This commit is not fixing the issue, but a problem described in one of
the comments.
2017-06-20 11:29:23 -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
018ebdd115 feat(frontends/lean/user_command): add user-defined commands 2017-06-19 11:27:12 -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
2866607319 chore(tests): fix tests 2017-06-18 18:33:38 -07:00
Leonardo de Moura
b8fa7f5311 fix(library): expr, level, hash_map, rb_map has_repr instances should be has_to_string since they do not produce results that can be parsed by Lean
See #1664
2017-06-18 18:33:27 -07: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
fe774a25cf chore(tests/lean/interactive): fix tests 2017-06-15 10:56:09 -07:00
Leonardo de Moura
5cb96c7fa3 feat(frontends/lean): add option for pretty printing metavars, sorry and delayed abstractions as holes
This option is false by default, but true when executing hole commands
2017-06-15 10:24:26 -07:00
Gabriel Ebner
028c31779d fix(frontends/lean/interactive): revert hole end column
I have tested this change in both emacs and vscode, and replacements
work correctly.

This reverts commit 6c2a144950.
2017-06-15 17:01:10 +02:00
Leonardo de Moura
6c2a144950 fix(frontends/lean/interactive): hole end column 2017-06-15 07:36:11 -07:00
Leonardo de Moura
ba25d4876e feat(frontends/lean/info_manager): multi-line holes 2017-06-15 07:23:06 -07:00
Gabriel Ebner
a001e85d82 fix(frontends/lean/builtin_exprs): set hole position after final token 2017-06-15 11:35:43 +02:00
Leonardo de Moura
7557a9e000 feat(shell/server,frontends/lean): add "hole_commands" server command
The new command returns the list of registered/applicable hole
commands.
2017-06-14 22:16:34 -07:00
Leonardo de Moura
55c8627f2c feat(frontends/lean): {! ... !} takes a list of pre-terms 2017-06-13 22:19:17 -07:00
Leonardo de Moura
dac6eec556 feat(library/tactic): add hole_command bookkeeping 2017-06-13 21:12:29 -07:00
Leonardo de Moura
bb2c39b471 feat(frontends/lean): add hole notation {! ... !}
Holes {! ... !} are elaborated using `sorry`.
We report an error if their value is fixed by typing and/or
elaboration rules.

We store the tactic_state and the optional attribute in the
info_manager. The idea is to allow users to execute commands with
respect to the stored tactic state and optional attribute.
The optional attribute is a pre term.

We are planning to add commands such as:
- Check type of the given argument.
- Reduce the given argument.
- Synthesize the hole automatically, where the given argument encodes
hint to the synthesizer.
- Use the given argument to fill the hole.
2017-06-13 18:53:05 -07:00