Skip to content

Commit e0bdea2

Browse files
committed
Stay with default reducibility in congr! and only change it in convert
1 parent 1b62985 commit e0bdea2

2 files changed

Lines changed: 17 additions & 6 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: 14 additions & 4 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.
@@ -201,7 +209,7 @@ def elabTermForConvert (term : Syntax) (expectedType? : Option Expr) :
201209
elab_rules : tactic
202210
| `(tactic| convert%$tk $[!%$semired]? $cfg $[←%$sym]? $term $[using $n]? $[with $ps?*]?) =>
203211
withMainContext do
204-
let baseConfig ← Congr!.elabConfig (mkOptionalNode cfg)
212+
let baseConfig := { ← Convert.elabConfig cfg with }
205213
let mut config := baseConfig
206214
if semired.isSome then
207215
config := { config with
@@ -276,7 +284,7 @@ elab_rules : tactic
276284
| `(tactic| convert_to $[!%$semireducible]? $cfg $[←%$sym]? $newType $[using $n]?
277285
$[with $ps?*]? $[$loc?:location]?) => do
278286
let n : ℕ := n |>.map (·.getNat) |>.getD 1
279-
let config ← Congr!.elabConfig (mkOptionalNode cfg)
287+
let config := { ← Convert.elabConfig cfg with }
280288
let patterns := (ps?.getD #[]).toList
281289
withLocation (expandOptLocation (mkOptionalNode loc?))
282290
(atLocal := fun fvarId ↦ do
@@ -321,7 +329,9 @@ syntax (name := acChange) "ac_change " term (" using " num)? : tactic
321329
syntax (name := acChange!) "ac_change! " term (" using " num)? : tactic
322330

323331
macro_rules
324-
| `(tactic| ac_change $t $[using $n]?) => `(tactic| convert_to $t:term $[using $n]? <;> try ac_rfl)
325-
| `(tactic| ac_change! $t $[using $n]?) => `(tactic| convert_to! $t:term $[using $n]? <;> try ac_rfl)
332+
| `(tactic| ac_change $t $[using $n]?) =>
333+
`(tactic| convert_to $t:term $[using $n]? <;> try ac_rfl)
334+
| `(tactic| ac_change! $t $[using $n]?) =>
335+
`(tactic| convert_to! $t:term $[using $n]? <;> try ac_rfl)
326336

327337
end Mathlib.Tactic

0 commit comments

Comments
 (0)