Commit graph

12742 commits

Author SHA1 Message Date
Sebastian Ullrich
c3d4c468e6 fix(init/meta/interactive): whnf in assume tactic 2017-07-04 12:20:38 -07:00
Leonardo de Moura
b68fe0d645 chore(tests/lean/interactive): fix test 2017-07-04 11:57:16 -07:00
Leonardo de Moura
dd3616dd16 feat(library/init/meta/interactive): simp_all ==> simp * at *
cc @Kha
2017-07-04 11:57:16 -07:00
Leonardo de Moura
d0ab9d0cd1 feat(library/init/meta/interactive): simp * as shorthand for simp [*] 2017-07-04 11:57:16 -07:00
Gabriel Ebner
b0185774a4 fix(library/vm/vm_expr): do not use expr_var as both function and class name 2017-07-04 09:10:35 +02:00
Gabriel Ebner
4a1fe588ea feat(lean-gdb.py): show expression kind 2017-07-04 08:38:19 +02:00
Leonardo de Moura
44c901bf11 fix(library/init/meta/interactive): make sure all input hypotheses are simplified before we clear the old ones
The new test exposes the bug.
The bug is similar to the one at `simp [h] at *` described at issue #1675
2017-07-03 21:58:55 -07:00
Leonardo de Moura
abef98c772 refactor(library/init/meta/simp_tactic): make sure dunfold tactics use name convention used at simp, dsimp, ... 2017-07-03 21:36:17 -07:00
Leonardo de Moura
b86847ec72 fix(library/init/logic): mark eq.substr with [elab_as_eliminator]
See issue #1718
2017-07-03 17:27:41 -07:00
Leonardo de Moura
e24f3341d4 feat(library/init/meta/interactive): simp without foo ==> simp [-foo]
This commit also adds "exception" validation.
A bad "exception" was being silently ignored.
We can also exclude hypotheses. Example: `simp [*, -h]`
2017-07-03 17:10:46 -07:00
Leonardo de Moura
76799db032 feat(library/init/meta/interactive): simph ==> simp [*]
This modification was suggested by @kha.

TODO:
- Use `simp [-f]` instead of `simp without f`
- Allow users to remove hypothesis from `*`. Example: `simp [*, -h]`
  for simplify using all hypotheses but `h`.
2017-07-03 15:14:47 -07:00
Leonardo de Moura
69ed291aab refactor(library/init/meta/simp_tactic): tactic.simp_at => tactic.simp_hyp 2017-07-03 14:07:18 -07:00
Leonardo de Moura
34c212fa53 refactor(library/init/meta/simp_tactic): cleanup simp_intros mess 2017-07-03 13:46:16 -07:00
Leonardo de Moura
6b3e28d30b feat(library/init/meta/simp_tactic): add option for reducing [reducible] definitions at dsimp, and to_unfold : list name similar to the one in the simp tactic
This complete addresses the two pending items at 16711fcdba
2017-07-03 13:28:46 -07:00
Leonardo de Moura
9a41f0f899 fix(library/init/meta/tactic): by_cases tactic
Before this commit, the `by_cases p` tactic would synthesize
`inst : decidable p` type class resolution, and then use the
`cases` tactic (dependent elimination). This would create
problems since occurrences of `inst` would be replaced with
`decidable.is_true h` in one branch, and `decidable.is_false h` in the
other. Where `h`s (we have two of them, one for each branch) are
fresh hypotheses introduced by the `cases` tactic.
For example, assume we have the term in our goal.

        `@ite p inst A a b`

This term would become

        `@ite p (decidable.is_true h) A a b` (in the first branch where `h : p`)

and
        `@ite p (decidable.is_false h) A a b` (in the second where `h : not p`)

Now, suppose we try to executed the following tactic in the first branch

        `rw [if_pos h]`

it will fail since `if_pos h` is actually `@if_pos p inst h`, and
we will not be able to unify

        `@ite p (decidable.is_true h) A a b =?= @ite p inst ?A ?a ?b`

This commit workarounds this problem by applying cases on
`@decidable.em p inst : p or not p` instead of `inst : decidable p`.
Thus, the term `inst` is not replaced with `decidable.is_true h` and
`decidable.is_false h`.

The new test `tests/lean/run/simp_dif.lean` demonstrates the problem above.
2017-07-02 21:34:10 -07:00
Leonardo de Moura
16711fcdba feat(library/tactic/dsimplify): new configuration options for dsimp
TODO for `dsimp`:
- Add an option for reducing [reducible] definitions
- Add (to_unfold : list name) similar to the one in the `simp` tactic
2017-07-02 18:26:03 -07:00
Leonardo de Moura
df091f5c34 feat(library/init/meta/interactive): simp and unfold can unfold projection applications
@Armael: we finally can write `simp [proj]` to unfold the `proj`
projection application.

Remark: we still need to add similar support for `dsimp`.
2017-07-02 16:28:04 -07:00
Leonardo de Moura
76eed7cb41 chore(library/init/meta): add to_unfold parameter to simplify, and remove redundant simp* tactics
Remark: the `to_unfold` has not been implemented yet.
2017-07-02 15:26:06 -07:00
Leonardo de Moura
d44f0bfb9e chore(library/init/meta/simp_tactic): fix typo 2017-07-02 11:53:00 -07:00
Leonardo de Moura
70b27fb2d3 feat(library/init/meta/interactive): unfold is now based on the simp framework
See issue #1694.

There is an orthogonal issue. `simp` (and consequently `unfold`) cannot be used to
reduce projections (e.g., `has_add.add`). This issue has been
previously raised by @Armael, but it was not addressed yet.
2017-07-02 11:30:48 -07:00
Leonardo de Moura
bd9f54cfe7 test(tests/lean/run/1675): simp_all and let 2017-07-02 10:15:00 -07:00
Leonardo de Moura
0b36e014e6 chore(tests/lean): fix tests 2017-07-01 21:12:29 -07:00
Leonardo de Moura
7b802392ed fix(library/init/meta/simp_tactic): simp_all should fail if nothing was simplified 2017-07-01 21:06:07 -07:00
Leonardo de Moura
01003b79cc fix(library/init/meta/interactive): simp [...] at *
closes #1675

After this commit, the following example works as expected.
```
example (p : nat → Prop) (a b : nat) : a = 0 ∧ b = 0 → p (a + b) → p 0 :=
begin
  intros h₁ h₂,
  simp [h₁] at *,
  /- produces the state
     (p : nat → Prop) (a b : nat)
     h₁ : true
     h₂ : p 0
     |- p 0
  -/
  assumption
end
```
as expected.
Remark: the original issue raised by issue #1675 is actually solved by the
`simp_all` tactic.
2017-07-01 20:50:46 -07:00
Leonardo de Moura
3422c8816e feat(library/init/meta/simp_tactic): improved simp_all tactic
It now performs self simplification, and the performance is slightly
better. As described at issue #1675, only non dependent propositions
are considered.

@Armael: this tactic may be useful for you
2017-07-01 20:26:29 -07:00
Leonardo de Moura
d73facb8bc feat(library/init/meta/expr): add expr.has_local_in 2017-07-01 20:23:37 -07:00
Leonardo de Moura
86baab061d doc(changes): describe for tactic for conv interactive mode 2017-07-01 15:39:53 -07:00
Leonardo de Moura
4604d7fd5a feat(library/init/meta): allow users to specify tactic for discharging subgoals in the simp tactic family
@dselsam @Armael: this feature may be useful for you.
The doc/changes.md describes many other new features.
2017-07-01 15:35:33 -07:00
Leonardo de Moura
7c35fae9e3 refactor(library/init/meta/simp_tactic): merge simplify_core and simplify 2017-07-01 14:13:49 -07:00
Leonardo de Moura
2f2694a343 chore(tests/lean/interactive/info_tactic): fix test output 2017-07-01 13:11:07 -07:00
Leonardo de Moura
799f0711d6 refactor(library/init/meta/simp_tactic): cleanup simp_lemmas.rewrite_core and simp_lemmas.drewrite_core 2017-07-01 13:04:26 -07:00
Leonardo de Moura
cf70df8a59 refactor(library/init/meta/simp_tactic): default_max_steps should not be in the top level 2017-07-01 12:57:00 -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
Leonardo de Moura
677ffd761d chore(library/tactic/simp_lemmas): do not use whnf when adding simp_lemmas
If the users want to normalize, then should use dsimp (or similar
tactic), before adding lemma to simp set.
2017-07-01 12:31:35 -07:00
Leonardo de Moura
e41c4d384d chore(library/tactic/simp_lemmas): remove unnecessary whnf 2017-07-01 12:17:53 -07:00
Leonardo de Moura
60a14f25df feat(library/init/meta/simp_tactic): add dunfold_expr back
`super` uses it.
2017-07-01 11:00:28 -07:00
Sebastian Ullrich
3cdf502c58 fix(frontends/lean/pp): escape keyword-like identifiers 2017-07-01 10:38:15 -07:00
Leonardo de Moura
b05c4e09ed feat(library/init/meta): add memoize field to simp_config and dsimp_config
We use `memoize := ff` when implementing `conv.interactive.for` and
`conv.interactive.find`.
2017-07-01 10:37:09 -07:00
Leonardo de Moura
36cc27fa0f feat(library/init/meta/converter/interactive): add for tactic to conv mode 2017-06-30 21:27:17 -07:00
Leonardo de Moura
b1bdc4690f feat(library/init/meta/simp_tactic): cleanup dunfold
Here are modifications:
- It fails if no definition is unfolded.
  See comment https://github.com/leanprover/lean/issues/1694#issuecomment-310956315
  at issue #1694

- Users can provide configuration parameters.

- `dunfold_occs` was deleted.
2017-06-30 20:49:20 -07:00
Leonardo de Moura
5882d5126f chore(library/init/meta/simp_tactic): use mfoldl 2017-06-30 19:42:08 -07:00
Leonardo de Moura
9504c9cabc feat(library/init/meta/converter): add support for dsimp parameters for conv mode 2017-06-30 17:37:24 -07:00
Leonardo de Moura
52d4189805 feat(library/tactic): add dsimp_config configuration object for the dsimp tactic family
Now, `dsimp` fails if the goal did not change.
We can use the config object to obtain the previous behavior:
```
dsimp {fail_if_unchaged := ff}
```
See comment https://github.com/leanprover/lean/issues/1694#issuecomment-310956315
at issue #1694
2017-06-30 17:15:10 -07:00
Leonardo de Moura
19f65b3b8a test(tests/lean/run/conv_tac1): another conv test 2017-06-30 12:49:41 -07:00
Leonardo de Moura
6208934134 feat(library/init/meta/converter/interactive): add support for rw at conv tactical 2017-06-30 12:41:35 -07:00
Leonardo de Moura
f7fe2a775c feat(library/init/meta/rewrite_tactic): improve rewrite tactic
`rewrite` tactic improvements
- Add support for `auto_param` and `opt_param`
- Order new goals using the same strategies available for `apply`
- Allow user to set configuration object in interactive mode.

@Armael This commit should address the issue you raised about the order
of new goals in the `rewrite` tactic.
See new test tests/lean/run/rw1.lean for examples.
2017-06-30 12:03:27 -07:00
Gabriel Ebner
c5af2a6f4c fix(library/module): unfold macros in inductive types 2017-06-30 17:49:50 +02: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
Gabriel Ebner
89c828d630 fix(library/library_task_builder): prevent uninitialized task results when cancelled 2017-06-30 08:32:34 +02:00
Corey Richardson
eda6660b2d doc(msys2): add notes about installation 2017-06-30 08:04:14 +02:00