Skip to content

Commit 66ddb61

Browse files
committed
Stay with default reducibility in congr! and only change it in convert
1 parent 02e1716 commit 66ddb61

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

Mathlib/Tactic/CongrExclamation.lean

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@ structure Congr!.Config where
117117
preTransparency : TransparencyMode := TransparencyMode.reducible
118118
/-- The transparency level to use when trying to close goals after no more congruence lemmas can
119119
be applied. This includes trying to prove the goal by `rfl` and using the `assumption` tactic.
120-
By default this is `.reducible`, which prevents unfolding of most definitions. -/
121-
postTransparency : TransparencyMode := TransparencyMode.reducible
120+
For backwards compatibility this is set to `.default`, which will be changed soon to `.reducible`.
121+
-/
122+
postTransparency : TransparencyMode := TransparencyMode.default
122123
/-- For passes that synthesize a congruence lemma using one side of the equality,
123124
we run the pass both for the left-hand side and the right-hand side. If `preferLHS` is `true`
124125
then we start with the left-hand side.

Mathlib/Tactic/Convert.lean

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ public meta section
7777

7878
open Lean Meta Elab Tactic
7979

80+
/-- Configuration for the `convert` family of tactics.
81+
This is `Congr!.Config` with different, less aggressive, defaults.
82+
-/
83+
structure Convert.Config extends Congr!.Config where
84+
postTransparency := .reducible
85+
86+
declare_config_elab Convert.elabConfig Convert.Config
87+
8088
/--
8189
Close the goal `g` using `Eq.mp v e`,
8290
where `v` is a metavariable asserting that the type of `g` and `e` are equal.
@@ -202,7 +210,7 @@ def elabTermForConvert (term : Syntax) (expectedType? : Option Expr) :
202210
elab_rules : tactic
203211
| `(tactic| convert%$tk $[!%$semired]? $cfg $[←%$sym]? $term $[using $n]? $[with $ps?*]?) =>
204212
withMainContext do
205-
let baseConfig ← Congr!.elabConfig (mkOptionalNode cfg)
213+
let baseConfig := { ← Convert.elabConfig cfg with }
206214
let mut config := baseConfig
207215
if semired.isSome then
208216
config := { config with
@@ -277,7 +285,9 @@ elab_rules : tactic
277285
| `(tactic| convert_to $[!%$semireducible]? $cfg $[←%$sym]? $newType $[using $n]?
278286
$[with $ps?*]? $[$loc?:location]?) => do
279287
let n : ℕ := n |>.map (·.getNat) |>.getD 1
280-
let config ← Congr!.elabConfig cfg
288+
let mut config := { ← Convert.elabConfig cfg with }
289+
if semireducible.isSome then
290+
config := { config with postTransparency := .default }
281291
let patterns := (ps?.getD #[]).toList
282292
withLocation (expandOptLocation (mkOptionalNode loc?))
283293
(atLocal := fun fvarId ↦ do

0 commit comments

Comments
 (0)