Commit 5faf7aa
committed
feat(Tactic/SimpIntro): add support for introducing non-propositions (#24372)
This PR improves the `simp_intro` tactic so that it can be used when there are non-propositions. Non-propositions are not added to the simp set. This lets `simp_intro` be used in situations that previously needed manual `intro` and `simp`.
For example, the following one can be solved like this
```lean
example (r : Nat → Prop) : (∀ x, x > 0 → r x) → ∀ y z, y = 0 → z > y → r z := by
simp
intro hr
try simp at hr -- does nothing
try simp [hr] -- does nothing
intro y z
try simp [hr] -- does nothing
intro hy
try simp [hr] at hy -- does nothing
simp [hr, hy]
intro hyz
try simp [hr, hy] at hyz
simp [hr, hy, hyz] -- accomplish the goal successfully
```
while the previous `simp_intro` cannot introduce `y` and `z` here.
```lean
example (r : Nat → Prop) : (∀ x, x > 0 → r x) → ∀ y z, y = 0 → z > y → r z := by
/- the previous `simp_intro` fails with message:
invalid 'simp', proposition expected
Nat -/
simp_intro .. -- or `simp_intro hr y`
example (r : Nat → Prop) : (∀ x, x > 0 → r x) → ∀ y z, y = 0 → z > y → r z := by
-- unsolved
simp_intro hr
```
Now with this PR, the tactic is successful:
```lean
example (r : Nat → Prop) : (∀ x, x > 0 → r x) → ∀ y z, y = 0 → z > y → r z := by
simp_intro .. -- or `simp_intro hr y z hy hz`
```1 parent 7e92ad1 commit 5faf7aa
2 files changed
+13
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
35 | 40 | | |
36 | 41 | | |
37 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
0 commit comments