Skip to content

Commit 084744e

Browse files
committed
Fix: also elaborate config correctly in presence of ! in convert_to
1 parent e0bdea2 commit 084744e

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

Mathlib/Tactic/Convert.lean

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,11 @@ def elabTermForConvert (term : Syntax) (expectedType? : Option Expr) :
207207
return t
208208

209209
elab_rules : tactic
210-
| `(tactic| convert%$tk $[!%$semired]? $cfg $[←%$sym]? $term $[using $n]? $[with $ps?*]?) =>
210+
| `(tactic| convert%$tk $[!%$semireducible]? $cfg $[←%$sym]? $term $[using $n]? $[with $ps?*]?) =>
211211
withMainContext do
212212
let baseConfig := { ← Convert.elabConfig cfg with }
213213
let mut config := baseConfig
214-
if semired.isSome then
214+
if semireducible.isSome then
215215
config := { config with
216216
-- TODO: also enable this in the future? (Not right now, for backwards compatibility).
217217
-- transparency := default,
@@ -220,7 +220,7 @@ elab_rules : tactic
220220
let patterns := (ps?.getD #[]).toList
221221
let expectedType ← mkFreshExprMVar (mkSort (← getLevel (← getMainTarget)))
222222
let (e, gs) ← elabTermForConvert term expectedType
223-
if semired.isSome then
223+
if semireducible.isSome then
224224
liftMetaTactic fun g ↦ do
225225
-- Suggest `convert` instead of `convert!` if that gives us the same goals.
226226
let redGoals ← g.convert e sym.isSome (n.map (·.getNat)) baseConfig patterns
@@ -284,7 +284,13 @@ elab_rules : tactic
284284
| `(tactic| convert_to $[!%$semireducible]? $cfg $[←%$sym]? $newType $[using $n]?
285285
$[with $ps?*]? $[$loc?:location]?) => do
286286
let n : ℕ := n |>.map (·.getNat) |>.getD 1
287-
let config := { ← Convert.elabConfig cfg with }
287+
let mut config := { ← Convert.elabConfig cfg with }
288+
if semireducible.isSome then
289+
config := { config with
290+
-- TODO: also enable this in the future? (Not right now, for backwards compatibility).
291+
-- transparency := default,
292+
-- preTransparency := default,
293+
postTransparency := default }
288294
let patterns := (ps?.getD #[]).toList
289295
withLocation (expandOptLocation (mkOptionalNode loc?))
290296
(atLocal := fun fvarId ↦ do

0 commit comments

Comments
 (0)