Skip to content

Commit 2d92fbb

Browse files
smmercuriBergschaf
authored andcommitted
perf(ValuativeRel/ValuativeTopology): local instance for isUniformAddGroup (leanprover-community#39965)
Make `ValuativeRel.isUniformAddGroup` a `local instance`. This is done to avoid diamonds similar to `ValuativeRel.uniformSpace`. It also reverts most of the performance degradation of leanprover-community#34045
1 parent e6b27bd commit 2d92fbb

4 files changed

Lines changed: 2 additions & 10 deletions

File tree

Mathlib/NumberTheory/RamificationInertia/Valuation.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ theorem valuation_liesOver (x : K) :
6161

6262
variable (K)
6363

64-
-- TODO: Can remove the `attribute [-instance] ValuativeRel.isUniformAddGroup` after #36769
65-
attribute [-instance] ValuativeRel.isUniformAddGroup in
6664
theorem uniformContinuous_algebraMap_liesOver :
6765
UniformContinuous (algebraMap (WithVal (v.valuation K)) (WithVal (w.valuation L))) := by
6866
refine uniformContinuous_of_continuousAt_zero _ ?_

Mathlib/RingTheory/DedekindDomain/FiniteAdeleRing.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ section Units
151151

152152
variable {R K}
153153

154-
-- TODO: Can remove the `attribute [-instance] ValuativeRel.isUniformAddGroup` after #36769
155-
attribute [-instance] ValuativeRel.isUniformAddGroup in
156154
set_option backward.isDefEq.respectTransparency false in
157155
theorem isUnit_iff {a : FiniteAdeleRing R K} :
158156
IsUnit a ↔ (∀ v, a v ≠ 0) ∧ ∀ᶠ v in Filter.cofinite, Valued.v (a v) = 1 := by

Mathlib/Topology/Algebra/ValuativeRel/ValuativeTopology.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ valuative and nonarchimedean, and the addition is uniformly continuous,
8080
can be automatically inferred. -/
8181
local instance uniformSpace : UniformSpace R := IsTopologicalAddGroup.rightUniformSpace R
8282

83-
instance isUniformAddGroup : IsUniformAddGroup R := isUniformAddGroup_of_addCommGroup
83+
/-- This is not made into a global instance to avoid diamonds. -/
84+
local instance isUniformAddGroup : IsUniformAddGroup R := isUniformAddGroup_of_addCommGroup
8485

8586
end ValuativeRel
8687

Mathlib/Topology/Algebra/Valued/WithVal.lean

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -517,8 +517,6 @@ theorem IsEquiv.orderRingIso_symm_apply (h : v.IsEquiv w) (x : WithVal w) :
517517

518518
open MonoidWithZeroHom MonoidWithZeroHom.ValueGroup₀
519519

520-
-- TODO: Can remove the `attribute [-instance] ValuativeRel.isUniformAddGroup` after #36769
521-
attribute [-instance] ValuativeRel.isUniformAddGroup in
522520
set_option backward.isDefEq.respectTransparency false in
523521
theorem IsEquiv.uniformContinuous_equiv [hval : Valued R Γ₀'] (hv : Valued.v = w)
524522
(h : v.IsEquiv w) : UniformContinuous (WithVal.equiv v) := by
@@ -542,8 +540,6 @@ theorem IsEquiv.uniformContinuous_equiv [hval : Valued R Γ₀'] (hv : Valued.v
542540
← hy, ← toVal_mul, ← h'.orderRingIso_apply, ← h'.orderRingIso.lt_symm_apply, lt_def]
543541
simpa [lt_div_iff₀ hs0', ← map_mul] using hx
544542

545-
-- TODO: Can remove the `attribute [-instance] ValuativeRel.isUniformAddGroup` after #36769
546-
attribute [-instance] ValuativeRel.isUniformAddGroup in
547543
set_option backward.isDefEq.respectTransparency false in
548544
theorem IsEquiv.uniformContinuous_equiv_symm [hval : Valued R Γ₀'] (hv : Valued.v = w)
549545
(h : w.IsEquiv v) : UniformContinuous (WithVal.equiv v).symm := by
@@ -641,7 +637,6 @@ theorem restrict_exists_div_eq {K : Type*} [Field K] {Γ₀ : Type*}
641637
embedding_strictMono.lt_iff_lt, map_zero]
642638
refine WithZero.pos_iff_ne_zero.mpr (Units.ne_zero γ)⟩
643639

644-
attribute [-instance] ValuativeRel.isUniformAddGroup in
645640
set_option backward.isDefEq.respectTransparency false in
646641
open UniformSpace.Completion in
647642
theorem IsEquiv.valuedCompletion_le_one_iff {K : Type*} [Field K] {v : Valuation K Γ₀}

0 commit comments

Comments
 (0)