@@ -226,32 +226,10 @@ elab_rules : tactic
226226 let expectedType ← mkFreshExprMVar (mkSort (← getLevel (← getMainTarget)))
227227 let (e, gs) ← elabTermForConvert term expectedType
228228 if semireducible.isNone then
229- liftMetaTactic fun g ↦ do
230- -- Suggest `convert!` instead of `convert` if we rely on default transparency.
231- let redGoals ← g.convert e sym.isSome (n.map (·.getNat))
232- { config with postTransparency := .reducible }
233- patterns
234- let defaultGoals ← g.convert e sym.isSome (n.map (·.getNat))
235- { config with postTransparency := .default }
236- patterns
237- if redGoals.length == defaultGoals.length then
238- let sameGoals ← try
239- (redGoals.zip defaultGoals).allM fun (g₁, g₂) => do
240- -- Check that they agree on the set of free variables, otherwise we get errors.
241- -- We assume the context in the `convert` case is a subset of the `convert!` case
242- -- since `convert!` can more agressively unfold and introduce more variables.
243- if !(← g₁.getDecl).lctx.isSubPrefixOf (← g₂.getDecl).lctx then return false
244- g₂.withContext <| withReducible <| isDefEq (← g₁.getType) (← g₂.getType)
245- catch _ => pure false
246- -- If the goals are not the same then we should preserve the original behaviour
247- -- and use `convert!`.
248- if !sameGoals then
249- let tac ← `(tactic| convert!%$tk $cfg $[←%$sym]? $term $[using $n]? $[with $ps?*]?)
250- TryThis.addSuggestion tk { suggestion := tac } (origSpan? := ← getRef)
251- return defaultGoals ++ gs
252- else
253- liftMetaTactic fun g ↦
254- return (← g.convert e sym.isSome (n.map (·.getNat)) config patterns) ++ gs
229+ let tac ← `(tactic| convert!%$tk $cfg $[←%$sym]? $term $[using $n]? $[with $ps?*]?)
230+ TryThis.addSuggestion tk { suggestion := tac } (origSpan? := ← getRef)
231+ liftMetaTactic fun g ↦
232+ return (← g.convert e sym.isSome (n.map (·.getNat)) config patterns) ++ gs
255233
256234/--
257235`convert_to t` on a goal `⊢ t'` changes the goal to `⊢ t` and adds new goals for proving the
0 commit comments