Commit graph

3656 commits

Author SHA1 Message Date
Gabriel Ebner
8f31cff99b chore(tests): move 1723 test to the expected output tests 2017-07-09 08:05:05 +02:00
Josh Pollock
ee55a03205 fix(src/library/vm,tests/lean): fixes #1723 2017-07-09 08:05:05 +02: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
Leonardo de Moura
9555a104d6 feat(library/init/meta/tactic): simplify ‹p› notation
@jroesch See the new test :)
2017-07-07 12:05:02 -07:00
Sebastian Ullrich
ac8de2472e feat(library/tactic/induction_tactic): clear hypothesis before introducing new ones 2017-07-07 10:06:30 -07:00
Leonardo de Moura
91f4fd9507 fix(library/equations_compiler/elim_match): undo bcf44f7
See issue #1739

Main problem with this commit: the counter-examples for non-exhaustive matches will be
cryptic when using nested inductive types.
2017-07-07 09:16:07 -07:00
Sebastian Ullrich
2bfdcc9069 chore(tests/lean/interactive/info_tactic): make independent of stdlib tactics 2017-07-07 11:22:12 +02:00
Sebastian Ullrich
99a87a9d01 chore(tests/lean/interactive/complete_field): remove. Not supported with new field notation anyway. 2017-07-07 11:22:10 +02:00
Leonardo de Moura
ced4b6a54d fix(library/init/meta/interactive): fixes #1733 2017-07-06 22:34:24 -07:00
Leonardo de Moura
38c2c7dae8 feat(library/equations_compiler/elim_match): extend is_value_transition trick to other infinite types 2017-07-06 22:10:23 -07:00
Gabriel Ebner
bcf44f7020 fix(library/equations_compiler): do not unfold generalized inductives 2017-07-06 22:04:58 -07:00
Gabriel Ebner
de587f938c fix(library/equations_compiler): always use ite for string literals 2017-07-06 22:04:58 -07:00
Gabriel Ebner
50821c9fac feat(library/equations_compiler): unpack counter-examples in wf recursion 2017-07-06 22:04:58 -07:00
Gabriel Ebner
4286adf868 feat(library/equations_compiler): use underscores for variables in missing cases 2017-07-06 22:04:58 -07:00
Gabriel Ebner
4fee7eaa70 feat(library/equations_compiler/elim_match): provide counter-examples for non-exhaustive matches 2017-07-06 22:04:58 -07:00
Leonardo de Moura
0cfb48c095 fix(library/equations_compiler/util): PR #1731 2017-07-06 21:29:23 -07:00
Sebastian Ullrich
c209cdc8be fix(kernel/inductive/inductive): identify indices modulo whnf 2017-07-06 20:59:58 -07:00
Sebastian Ullrich
d386e65775 fix(library/equations_compiler/util): noequation: guess arity modulo whnf 2017-07-06 20:59:58 -07:00
Gabriel Ebner
d610709a53 fix(frontends/lean/print_cmd): report error on unknown identifier 2017-07-06 19:58:30 +02:00
Gabriel Ebner
f55d10bb50 chore(tests/lean/interactive): fix tests 2017-07-06 16:32:50 +02:00
Leonardo de Moura
514c1e30c9 fix(library/tactic/dsimplify): issue reported by @semorrison at gitter
`dsimp` option `unfold_reducible` was not working correctly.
2017-07-05 21:48:44 -07:00
Leonardo de Moura
cfab344bcc fix(library/delayed_abstraction): fixes #1728 2017-07-05 17:10:18 -07:00
Jeremy Avigad
5fd113f50f feat(library/init/logic): add simp rule for 'true implies p' 2017-07-05 14:26:04 -07:00
Leonardo de Moura
1bc9af53f2 fix(library/init/meta/simp_tactic): fixes #1724 2017-07-05 11:59:23 -07:00
Leonardo de Moura
bb9e3ddae2 feat(library/init/meta/interactive): rw [-h] ==> rw [← h]
@Armael: this change may affect your project.

The file `doc/changes.md` explains the motivation for the change.
2017-07-05 11:42:55 -07:00
Leonardo de Moura
a76e839e5a chore(tests/lean/keyword_tactics): fix test output 2017-07-05 11:20:10 -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
30f4b2f2dd refactor(library): list.taken/dropn ~> list.take/drop 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
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
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
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
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
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