lean4-htt/library/init/data
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
..
array refactor(frontends/lean/tactic_notation): rename note/define tactics to have/let 2017-06-22 08:03:23 -07:00
bool chore(library/init/data/bool/lemmas): add (coe tt) and (coe ff) simp lemmas 2017-03-05 09:50:01 -08:00
char refactor(frontends/lean/tactic_notation): rename note/define tactics to have/let 2017-06-22 08:03:23 -07:00
fin refactor(frontends/lean/tactic_notation): rename note/define tactics to have/let 2017-06-22 08:03:23 -07:00
int feat(library/init/meta/interactive): simp and unfold can unfold projection applications 2017-07-02 16:28:04 -07:00
list feat(library/tactic/dsimplify): new configuration options for dsimp 2017-07-02 18:26:03 -07:00
nat fix(library/init/meta/tactic): by_cases tactic 2017-07-02 21:34:10 -07:00
option feat(init/data/option): option.get 2017-05-27 04:14:05 -04:00
sigma refactor(frontends/lean/tactic_notation): rename note/define tactics to have/let 2017-06-22 08:03:23 -07:00
string refactor(library): has_to_string ==> has_repr 2017-06-18 18:29:19 -07:00
subtype feat(init/data/subtype): add subtype.eta 2017-05-27 04:13:59 -04:00
sum feat(frontends/lean): no global universes in the frontend 2017-02-08 17:23:04 -08:00
unsigned feat(library/init/data/fin): add div 2017-03-05 16:43:15 -08:00
basic.lean refactor(library): add has_to_string back (but it produces unquoted values) 2017-06-18 18:30:10 -07:00
default.lean feat(library/init/data/unsigned): add basic unsigned operations 2017-03-05 16:14:16 -08:00
option_t.lean refactor(frontends/lean/tactic_notation): rename note/define tactics to have/let 2017-06-22 08:03:23 -07:00
ordering.lean refactor(library): has_to_string ==> has_repr 2017-06-18 18:29:19 -07:00
prod.lean feat(library/init/data/prod): add prod.map 2017-03-07 19:30:51 -08:00
quot.lean feat(init/data/quot): show that quot is the quotient by the generated equivalence 2017-05-27 04:14:00 -04:00
repr.lean fix(library/init/data/repr): give correct implementation of nat.repr 2017-06-19 16:20:27 +02:00
set.lean feat(library/tactic/dsimplify): new configuration options for dsimp 2017-07-02 18:26:03 -07:00
setoid.lean chore(library/init/data/quot): use Sort instead of Type 2017-03-07 14:29:57 -08:00
to_string.lean refactor(library): add has_to_string back (but it produces unquoted values) 2017-06-18 18:30:10 -07:00
unit.lean refactor(library/data): delete init/data/instances.lean 2016-12-02 16:41:16 -08:00