@@ -132,6 +132,8 @@ pattern-matched, like `rintro` would, using the `with` keyword.
132132See also `convert_to t`, where `t` specifies the expected type, instead of a proof term of type `t`.
133133In other words, `convert_to t` works like `convert (?_ : t)`. Both tactics use the same options.
134134
135+ * `convert! e` uses default transparency when solving side goals. This is currently the same
136+ behaviour as `convert`, but `convert` will use reducible transparency in the future.
135137* `convert ← e` creates equality goals in the opposite direction (with the goal type on the right).
136138* `convert e using n`, where `n` is a positive numeral, controls the depth with which congruence is
137139 applied. For example, if the main goal is `⊢ Prime (n + n + 1)` and `e : Prime (2 * n + 1)`, then
@@ -173,6 +175,14 @@ example (p q : Nat → Prop) (h : ∀ ε > 0, p ε) :
173175syntax (name := convert) "convert" Lean.Parser.Tactic.optConfig " ←" ? ppSpace term (" using " num)?
174176 (" with" (ppSpace colGt rintroPat)*)? : tactic
175177
178+ @ [tactic_alt convert]
179+ syntax (name := convert!) "convert!" Lean.Parser.Tactic.optConfig " ←" ? ppSpace term
180+ (" using " num)? (" with" (ppSpace colGt rintroPat)*)? : tactic
181+
182+ macro_rules
183+ | `(tactic| convert! $cfg $[←%$l]? $t $[using $n]? $[with $[$w]*]?) =>
184+ `(tactic| convert $cfg $[←%$l]? $t:term $[using $n]? $[with $[$w]*]?)
185+
176186/--
177187Elaborates `term` ensuring the expected type, allowing stuck metavariables.
178188Returns stuck metavariables as additional goals.
@@ -211,6 +221,8 @@ pattern-matched, like `rintro` would, using the `with` keyword.
211221`convert e`, where `e` is a term of type `t`, uses `e` to close the new main goal. In other words,
212222`convert e` works like `convert_to t; refine e`. Both tactics use the same options.
213223
224+ * `convert_to! t` uses default transparency when solving side goals. This is currently the same
225+ behaviour as `convert_to`, but `convert_to` will use reducible transparency in the future.
214226* `convert_to ty at h` changes the type of the local hypothesis `h` to `ty`. If later local
215227 hypotheses or the goal depend on `h`, then `convert_to t at h` may leave a copy of `h`.
216228* `convert_to ← t` creates equality goals in the opposite direction (with the original goal type on
@@ -226,14 +238,22 @@ pattern-matched, like `rintro` would, using the `with` keyword.
226238* `convert_to (config := cfg) t` uses the configuration options in `cfg` to control the congruence
227239 rules (see `Congr!.Config`).
228240 -/
229- syntax (name := convertTo) "convert_to" (Parser.Tactic.config)? " ←" ? ppSpace term (" using " num)?
230- (" with" (ppSpace colGt rintroPat)*)? (Parser.Tactic.location)? : tactic
241+ syntax (name := convertTo) "convert_to" Lean.Parser.Tactic.optConfig " ←" ? ppSpace term
242+ (" using " num)? (" with" (ppSpace colGt rintroPat)*)? (Parser.Tactic.location)? : tactic
243+
244+ @ [tactic_alt convertTo]
245+ syntax (name := convert_to!) "convert_to!" Lean.Parser.Tactic.optConfig " ←" ? ppSpace term
246+ (" using " num)? (" with" (ppSpace colGt rintroPat)*)? (Parser.Tactic.location)? : tactic
247+
248+ macro_rules
249+ | `(tactic| convert_to! $cfg $[←%$l]? $t $[using $n]? $[with $w]? $[$loc]?) =>
250+ `(tactic| convert_to $cfg $[←%$l]? $t:term $[using $n]? $[with $w]? $[$loc]?)
231251
232252elab_rules : tactic
233- | `(tactic| convert_to $[$ cfg:config]? $[←%$sym]? $newType $[using $n]?
253+ | `(tactic| convert_to $cfg $[←%$sym]? $newType $[using $n]?
234254 $[with $ps?*]? $[$loc?:location]?) => do
235255 let n : ℕ := n |>.map (·.getNat) |>.getD 1
236- let config ← Congr!.elabConfig (mkOptionalNode cfg)
256+ let config ← Congr!.elabConfig cfg
237257 let patterns := (ps?.getD #[]).toList
238258 withLocation (expandOptLocation (mkOptionalNode loc?))
239259 (atLocal := fun fvarId ↦ do
@@ -259,6 +279,8 @@ into new goals, using the hole's name, if any, as the goal case name.
259279Like `congr!`, `convert_to` introduces variables while applying congruence rules. These can be
260280pattern-matched, like `rintro` would, using the `with` keyword.
261281
282+ * `ac_change! t` uses default transparency when solving side goals. This is currently the same
283+ behaviour as `ac_change`, but `ac_change` will use reducible transparency in the future.
262284* `ac_change t using n`, where `n` is a positive numeral, controls the depth with which congruence
263285 is applied. For example, if the main goal is `⊢ Prime ((a * b + 1) + c)`,
264286 then `ac_change Prime ((1 + a * b) + c) using 2` solves the side goals, and
@@ -274,8 +296,14 @@ example (a b c d e f g N : ℕ) : (a + b) + (c + d) + (e + f) + g ≤ N := by
274296```
275297-/
276298syntax (name := acChange) "ac_change " term (" using " num)? : tactic
299+ @ [tactic_alt acChange]
300+ syntax (name := acChange!) "ac_change! " term (" using " num)? : tactic
277301
278302macro_rules
279- | `(tactic| ac_change $t $[using $n]?) => `(tactic| convert_to $t:term $[using $n]? <;> try ac_rfl)
303+ | `(tactic| ac_change $t $[using $n]?) =>
304+ `(tactic| convert_to $t:term $[using $n]? <;> try ac_rfl)
305+ | `(tactic| ac_change! $t $[using $n]?) =>
306+ `(tactic| convert_to! $t:term $[using $n]? <;> try ac_rfl)
307+
280308
281309end Mathlib.Tactic
0 commit comments