|
1 | 1 | # Tactics |
2 | 2 |
|
3 | | -Mathlib version: `de7ac7cb70710498104300af3c811b05efbb48c6` |
| 3 | +Mathlib version: `ac48e6adc8b30cd28a5e3d428a25300457ae7243` |
4 | 4 |
|
5 | 5 | ## \#adaptation_note |
6 | 6 | Defined in: `«tactic#adaptation_note_»` |
@@ -2888,24 +2888,8 @@ A macro for a common simplification when rewriting with ghost component equation |
2888 | 2888 | ## grewrite |
2889 | 2889 | Defined in: `Mathlib.Tactic.grewriteSeq` |
2890 | 2890 |
|
2891 | | -`grewrite [e]` works just like `rewrite [e]`, but `e` can be a relation other than `=` or `↔`. |
2892 | | - |
2893 | | -For example, |
2894 | | -```lean |
2895 | | -variable {a b c d n : ℤ} |
2896 | | -
|
2897 | | -example (h₁ : a < b) (h₂ : b ≤ c) : a + d ≤ c + d := by |
2898 | | - grewrite [h₁, h₂]; rfl |
2899 | | -
|
2900 | | -example (h : a ≡ b [ZMOD n]) : a ^ 2 ≡ b ^ 2 [ZMOD n] := by |
2901 | | - grewrite [h]; rfl |
2902 | | -
|
2903 | | -example (h₁ : a ∣ b) (h₂ : b ∣ a ^ 2 * c) : a ∣ b ^ 2 * c := by |
2904 | | - grewrite [h₁] at * |
2905 | | - exact h₂ |
2906 | | -``` |
2907 | | -To be able to use `grewrite`, the relevant lemmas need to be tagged with `@[gcongr]`. |
2908 | | -To rewrite inside a transitive relation, you can also give it an `IsTrans` instance. |
| 2891 | +`grewrite [e]` is like `grw [e]`, but it doesn't try to close the goal with `rfl`. |
| 2892 | +This is analogous to `rw` and `rewrite`, where `rewrite` doesn't try to close the goal with `rfl`. |
2909 | 2893 |
|
2910 | 2894 | ## grind |
2911 | 2895 | Defined in: `Lean.Parser.Tactic.grind` |
@@ -3228,6 +3212,9 @@ example (h₁ : a ∣ b) (h₂ : b ∣ a ^ 2 * c) : a ∣ b ^ 2 * c := by |
3228 | 3212 | grw [h₁] at * |
3229 | 3213 | exact h₂ |
3230 | 3214 | ``` |
| 3215 | +To rewrite only in the `n`-th position, use `nth_grw n`. |
| 3216 | +This is useful when `grw` tries to rewrite in a position that is not valid for the given relation. |
| 3217 | + |
3231 | 3218 | To be able to use `grw`, the relevant lemmas need to be tagged with `@[gcongr]`. |
3232 | 3219 | To rewrite inside a transitive relation, you can also give it an `IsTrans` instance. |
3233 | 3220 |
|
@@ -6053,6 +6040,9 @@ built in for `push Not`, so that it can preserve binder names, and so that `¬ ( |
6053 | 6040 | transformed to either `p → ¬ q` (the default) or `¬ p ∨ ¬ q`. To get `¬ p ∨ ¬ q`, use |
6054 | 6041 | `set_option push_neg.use_distrib true`. |
6055 | 6042 |
|
| 6043 | +Tactics that introduce a negation usually have a version that automatically calls `push_neg` on |
| 6044 | +that negation. These include `by_cases!`, `contrapose!` and `by_contra!`. |
| 6045 | + |
6056 | 6046 | Another example: given a hypothesis |
6057 | 6047 | ```lean |
6058 | 6048 | h : ¬ ∀ ε > 0, ∃ δ > 0, ∀ x, |x - x₀| ≤ δ → |f x - y₀| ≤ ε |
|
0 commit comments