Skip to content

Commit b4e4e50

Browse files
committed
chore: remove unnecessary private and backward.privateInPublic (#36430)
This PR removes `private` modifiers and corresponding `set_option backward.privateInPublic` from definitions in three files where they are not really sensible. These private definitions were being exposed to public proofs via `backward.privateInPublic`, which means the private names (with `_private.` mangling) appear in downstream goal states. When the tactic analysis regression linter tries to re-run replacement tactics on those goals, it encounters "Unknown constant" errors because the private constants aren't accessible from other modules. Files changed: - `Mathlib.RingTheory.OreLocalization.Basic`: remove `private` from `add''`, `add''_char`, `add'`, `add`, `nsmul` - `Mathlib.Analysis.Complex.Norm`: change `private` to `protected` for `norm_nonneg`, `norm_add_le'`, `norm_eq_zero_iff`, `norm_map_zero'`, `norm_neg'` (these names clash with global names from `NormedAddCommGroup`) - `Mathlib.Analysis.Normed.Module.Multilinear.Basic`: remove `private` from `uniformity_eq_seminorm` Verified locally: all three files and their downstream dependencies build successfully. 🤖 Prepared with Claude Code
1 parent 237a3de commit b4e4e50

File tree

3 files changed

+23
-37
lines changed

3 files changed

+23
-37
lines changed

Mathlib/Analysis/Complex/Norm.lean

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,49 +30,43 @@ theorem norm_def (z : ℂ) : ‖z‖ = √(normSq z) := rfl
3030
theorem norm_mul_self_eq_normSq (z : ℂ) : ‖z‖ * ‖z‖ = normSq z :=
3131
Real.mul_self_sqrt (normSq_nonneg _)
3232

33-
private theorem norm_nonneg (z : ℂ) : 0 ≤ ‖z‖ :=
33+
protected theorem norm_nonneg (z : ℂ) : 0 ≤ ‖z‖ :=
3434
Real.sqrt_nonneg _
3535

3636
@[bound]
3737
theorem abs_re_le_norm (z : ℂ) : |z.re| ≤ ‖z‖ := by
38-
rw [mul_self_le_mul_self_iff (abs_nonneg z.re) (norm_nonneg _), abs_mul_abs_self,
38+
rw [mul_self_le_mul_self_iff (abs_nonneg z.re) (Complex.norm_nonneg _), abs_mul_abs_self,
3939
norm_mul_self_eq_normSq]
4040
apply re_sq_le_normSq
4141

4242
theorem re_le_norm (z : ℂ) : z.re ≤ ‖z‖ :=
4343
(abs_le.1 (abs_re_le_norm _)).2
4444

45-
set_option backward.privateInPublic true in
46-
private theorem norm_add_le' (z w : ℂ) : ‖z + w‖ ≤ ‖z‖ + ‖w‖ :=
47-
(mul_self_le_mul_self_iff (norm_nonneg (z + w)) (add_nonneg (norm_nonneg z)
48-
(norm_nonneg w))).2 <| by
45+
protected theorem norm_add_le' (z w : ℂ) : ‖z + w‖ ≤ ‖z‖ + ‖w‖ :=
46+
(mul_self_le_mul_self_iff (Complex.norm_nonneg (z + w)) (add_nonneg (Complex.norm_nonneg z)
47+
(Complex.norm_nonneg w))).2 <| by
4948
rw [norm_mul_self_eq_normSq, add_mul_self_eq, norm_mul_self_eq_normSq, norm_mul_self_eq_normSq,
5049
add_right_comm, normSq_add, mul_assoc, norm_def, norm_def, ← Real.sqrt_mul <| normSq_nonneg z,
5150
← normSq_conj w, ← map_mul]
5251
gcongr
5352
exact re_le_norm (z * conj w)
5453

55-
set_option backward.privateInPublic true in
56-
private theorem norm_eq_zero_iff {z : ℂ} : ‖z‖ = 0 ↔ z = 0 :=
54+
protected theorem norm_eq_zero_iff {z : ℂ} : ‖z‖ = 0 ↔ z = 0 :=
5755
(Real.sqrt_eq_zero <| normSq_nonneg _).trans normSq_eq_zero
5856

59-
set_option backward.privateInPublic true in
60-
private theorem norm_map_zero' : ‖(0 : ℂ)‖ = 0 :=
61-
norm_eq_zero_iff.mpr rfl
57+
protected theorem norm_map_zero' : ‖(0 : ℂ)‖ = 0 :=
58+
Complex.norm_eq_zero_iff.mpr rfl
6259

63-
set_option backward.privateInPublic true in
64-
private theorem norm_neg' (z : ℂ) : ‖-z‖ = ‖z‖ := by
60+
protected theorem norm_neg' (z : ℂ) : ‖-z‖ = ‖z‖ := by
6561
rw [Complex.norm_def, norm_def, normSq_neg]
6662

67-
set_option backward.privateInPublic true in
68-
set_option backward.privateInPublic.warn false in
6963
instance instNormedAddCommGroup : NormedAddCommGroup ℂ :=
7064
AddGroupNorm.toNormedAddCommGroup
7165
{ toFun := norm
72-
map_zero' := norm_map_zero'
73-
add_le' := norm_add_le'
74-
neg' := norm_neg'
75-
eq_zero_of_map_eq_zero' := fun _ ↦ norm_eq_zero_iff.mp }
66+
map_zero' := Complex.norm_map_zero'
67+
add_le' := Complex.norm_add_le'
68+
neg' := Complex.norm_neg'
69+
eq_zero_of_map_eq_zero' := fun _ ↦ Complex.norm_eq_zero_iff.mp }
7670

7771
@[simp 1100]
7872
protected theorem norm_mul (z w : ℂ) : ‖z * w‖ = ‖z‖ * ‖w‖ := by
@@ -84,7 +78,7 @@ protected theorem norm_div (z w : ℂ) : ‖z / w‖ = ‖z‖ / ‖w‖ := by
8478

8579
instance isAbsoluteValueNorm : IsAbsoluteValue (‖·‖ : ℂ → ℝ) where
8680
abv_nonneg' := norm_nonneg
87-
abv_eq_zero' := norm_eq_zero_iff
81+
abv_eq_zero' := Complex.norm_eq_zero_iff
8882
abv_add' := norm_add_le
8983
abv_mul' := Complex.norm_mul
9084

Mathlib/Analysis/Normed/Module/Multilinear/Basic.lean

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,7 @@ so that it is definitionally equal to the one coming from the topologies on `E`
450450
protected def seminorm : Seminorm 𝕜 (ContinuousMultilinearMap 𝕜 E G) :=
451451
.ofSMulLE norm opNorm_zero opNorm_add_le fun c f ↦ f.opNorm_smul_le c
452452

453-
set_option backward.privateInPublic true in
454-
private lemma uniformity_eq_seminorm :
453+
lemma uniformity_eq_seminorm :
455454
𝓤 (ContinuousMultilinearMap 𝕜 E G) = ⨅ r > 0, 𝓟 {f | ‖-f.1 + f.2‖ < r} := by
456455
have A (f : ContinuousMultilinearMap 𝕜 E G × ContinuousMultilinearMap 𝕜 E G) :
457456
‖-f.1 + f.2‖ = ‖f.1 - f.2‖ := by rw [← opNorm_neg, neg_add, neg_neg, sub_eq_add_neg]
@@ -484,8 +483,6 @@ private lemma uniformity_eq_seminorm :
484483
_ ≤ δ * ε ^ Fintype.card ι := by have := (norm_nonneg x).trans hx; gcongr
485484
_ ≤ r := (mul_comm _ _).trans_le hδ.le
486485

487-
set_option backward.privateInPublic true in
488-
set_option backward.privateInPublic.warn false in
489486
instance instPseudoMetricSpace : PseudoMetricSpace (ContinuousMultilinearMap 𝕜 E G) :=
490487
.replaceUniformity
491488
(ContinuousMultilinearMap.seminorm 𝕜 E G).toSeminormedAddCommGroup.toPseudoMetricSpace

Mathlib/RingTheory/OreLocalization/Basic.lean

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ section DistribMulAction
7878
variable {R : Type*} [Monoid R] {S : Submonoid R} [OreSet S] {X : Type*} [AddMonoid X]
7979
variable [DistribMulAction R X]
8080

81-
set_option backward.privateInPublic true in
82-
private def add'' (r₁ : X) (s₁ : S) (r₂ : X) (s₂ : S) : X[S⁻¹] :=
81+
/-- Auxiliary definition for addition on the Ore localization. -/
82+
def add'' (r₁ : X) (s₁ : S) (r₂ : X) (s₂ : S) : X[S⁻¹] :=
8383
(oreDenom (s₁ : R) s₂ • r₁ + oreNum (s₁ : R) s₂ • r₂) /ₒ (oreDenom (s₁ : R) s₂ * s₁)
8484

85-
private theorem add''_char (r₁ : X) (s₁ : S) (r₂ : X) (s₂ : S) (rb : R) (sb : R)
85+
theorem add''_char (r₁ : X) (s₁ : S) (r₂ : X) (s₂ : S) (rb : R) (sb : R)
8686
(hb : sb * s₁ = rb * s₂) (h : sb * s₁ ∈ S) :
8787
add'' r₁ s₁ r₂ s₂ = (sb • r₁ + rb • r₂) /ₒ ⟨sb * s₁, h⟩ := by
8888
simp only [add'']
@@ -103,8 +103,8 @@ private theorem add''_char (r₁ : X) (s₁ : S) (r₂ : X) (s₂ : S) (rb : R)
103103

104104
attribute [local instance] OreLocalization.oreEqv
105105

106-
set_option backward.privateInPublic true in
107-
private def add' (r₂ : X) (s₂ : S) : X[S⁻¹] → X[S⁻¹] :=
106+
/-- Auxiliary definition for addition on the Ore localization, with one argument fixed. -/
107+
def add' (r₂ : X) (s₂ : S) : X[S⁻¹] → X[S⁻¹] :=
108108
(--plus tilde
109109
Quotient.lift
110110
fun r₁s₁ : X × S => add'' r₁s₁.1 r₁s₁.2 r₂ s₂) <| by
@@ -126,10 +126,9 @@ private def add' (r₂ : X) (s₂ : S) : X[S⁻¹] → X[S⁻¹] :=
126126
simp only [mul_smul, smul_add, one_smul, OneMemClass.coe_one, one_mul, true_and]
127127
rw [this, hc, mul_assoc]
128128

129-
set_option backward.privateInPublic true in
130129
/-- The addition on the Ore localization. -/
131130
@[irreducible]
132-
private def add : X[S⁻¹] → X[S⁻¹] → X[S⁻¹] := fun x =>
131+
def add : X[S⁻¹] → X[S⁻¹] → X[S⁻¹] := fun x =>
133132
Quotient.lift (fun rs : X × S => add' rs.1 rs.2 x)
134133
(by
135134
rintro ⟨r₁, s₁⟩ ⟨r₂, s₂⟩ ⟨sb, rb, hb, hb'⟩
@@ -148,8 +147,6 @@ private def add : X[S⁻¹] → X[S⁻¹] → X[S⁻¹] := fun x =>
148147
simp only [one_smul, one_mul, mul_smul, ← hb, Submonoid.smul_def, ← mul_assoc, and_true]
149148
simp only [smul_smul, hd])
150149

151-
set_option backward.privateInPublic true in
152-
set_option backward.privateInPublic.warn false in
153150
instance : Add X[S⁻¹] :=
154151
⟨add⟩
155152

@@ -205,12 +202,10 @@ protected theorem add_zero (x : X[S⁻¹]) : x + 0 = x := by
205202
induction x
206203
rw [← zero_oreDiv, add_oreDiv]; simp
207204

208-
set_option backward.privateInPublic true in
205+
/-- Scalar multiplication by natural numbers on the Ore localization. -/
209206
@[irreducible]
210-
private def nsmul : ℕ → X[S⁻¹] → X[S⁻¹] := nsmulRec
207+
def nsmul : ℕ → X[S⁻¹] → X[S⁻¹] := nsmulRec
211208

212-
set_option backward.privateInPublic true in
213-
set_option backward.privateInPublic.warn false in
214209
instance : AddMonoid X[S⁻¹] where
215210
add_assoc := OreLocalization.add_assoc
216211
zero_add := OreLocalization.zero_add

0 commit comments

Comments
 (0)