Skip to content

Commit 553449c

Browse files
committed
chore: remove some duplicate instances (#25410)
I have a program that finds duplicate instances, as described at [#mathlib4 > duplicate declarations](https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/duplicate.20declarations/with/518941841) This PR is a start at fixing these in Mathlib.
1 parent 2986ee0 commit 553449c

File tree

29 files changed

+26
-132
lines changed

29 files changed

+26
-132
lines changed

Mathlib/Algebra/Category/Grp/Adjunctions.lean

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ instance : free.{u}.IsLeftAdjoint :=
7979
instance : (forget AddCommGrp.{u}).IsRightAdjoint :=
8080
⟨_, ⟨adj⟩⟩
8181

82-
instance : AddCommGrp.free.{u}.IsLeftAdjoint :=
83-
⟨_, ⟨adj⟩⟩
84-
8582
/-- As an example, we now give a high-powered proof that
8683
the monomorphisms in `AddCommGroup` are just the injective functions.
8784

Mathlib/Algebra/Category/ModuleCat/Basic.lean

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,6 @@ def homEquiv {M N : ModuleCat.{v} R} : (M ⟶ N) ≃ (M →ₗ[R] N) where
186186

187187
end
188188

189-
instance : Inhabited (ModuleCat R) :=
190-
⟨of R R⟩
191-
192189
/- Not a `@[simp]` lemma since it will rewrite the (co)domain of maps and cause
193190
definitional equality issues. -/
194191
lemma forget_obj {M : ModuleCat.{v} R} : (forget (ModuleCat.{v} R)).obj M = M := rfl

Mathlib/Algebra/Group/Fin/Basic.lean

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ instance addCommSemigroup (n : ℕ) : AddCommSemigroup (Fin n) where
2929
add_assoc := by simp [add_def, Nat.add_assoc]
3030
add_comm := by simp [add_def, Nat.add_comm]
3131

32-
instance (n) : AddCommSemigroup (Fin n) where
33-
add_assoc := by simp [add_def, Nat.add_assoc]
34-
add_comm := by simp [add_def, add_comm]
35-
3632
instance addCommMonoid (n : ℕ) [NeZero n] : AddCommMonoid (Fin n) where
3733
zero_add := Fin.zero_add
3834
add_zero := Fin.add_zero

Mathlib/Algebra/Homology/Embedding/IsSupported.lean

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ lemma isStrictlySupported_op_iff :
5757
⟨(fun _ ↦ ⟨fun i' hi' ↦ (K.op.isZero_X_of_isStrictlySupported e.op i' hi').unop⟩),
5858
(fun _ ↦ ⟨fun i' hi' ↦ (K.isZero_X_of_isStrictlySupported e i' hi').op⟩)⟩
5959

60-
instance [K.IsStrictlySupported e] :
61-
K.op.IsStrictlySupported e.op := by
60+
instance [K.IsStrictlySupported e] : K.op.IsStrictlySupported e.op := by
6261
rw [isStrictlySupported_op_iff]
6362
infer_instance
6463

@@ -137,9 +136,6 @@ lemma isZero_iff_isStrictlySupported_and_isStrictlySupportedOutside :
137136
exact h₂.isZero i
138137
· exact K.isZero_X_of_isStrictlySupported e _ (by simpa using hn)
139138

140-
instance [K.IsStrictlySupported e] : K.op.IsStrictlySupported e.op where
141-
isZero j hj' := (K.isZero_X_of_isStrictlySupported e j hj').op
142-
143139
end
144140

145141
section

Mathlib/Algebra/Order/Hom/Monoid.lean

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,6 @@ def OrderMonoidIsoClass.toOrderMonoidIso [EquivLike F α β] [OrderIsoClass F α
164164
α ≃*o β :=
165165
{ (f : α ≃* β) with map_le_map_iff' := OrderIsoClass.map_le_map_iff f }
166166

167-
/-- Any type satisfying `OrderMonoidHomClass` can be cast into `OrderMonoidHom` via
168-
`OrderMonoidHomClass.toOrderMonoidHom`. -/
169-
@[to_additive "Any type satisfying `OrderAddMonoidHomClass` can be cast into `OrderAddMonoidHom` via
170-
`OrderAddMonoidHomClass.toOrderAddMonoidHom`"]
171-
instance [OrderHomClass F α β] [MonoidHomClass F α β] : CoeTC F (α →*o β) :=
172-
⟨OrderMonoidHomClass.toOrderMonoidHom⟩
173-
174167
/-- Any type satisfying `OrderMonoidIsoClass` can be cast into `OrderMonoidIso` via
175168
`OrderMonoidIsoClass.toOrderMonoidIso`. -/
176169
@[to_additive "Any type satisfying `OrderAddMonoidIsoClass` can be cast into `OrderAddMonoidIso` via

Mathlib/Algebra/Ring/Divisibility/Basic.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Authors: Jeremy Avigad, Leonardo de Moura, Floris van Doorn, Yury Kudryashov, Ne
66
import Mathlib.Algebra.Divisibility.Hom
77
import Mathlib.Algebra.Group.Equiv.Basic
88
import Mathlib.Algebra.Ring.Defs
9-
import Mathlib.Data.Nat.Basic
109

1110
/-!
1211
# Lemmas about divisibility in rings

Mathlib/Algebra/Ring/Subsemiring/Basic.lean

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -917,11 +917,6 @@ instance distribMulAction [AddMonoid α] [DistribMulAction R' α] (S : Subsemiri
917917
DistribMulAction S α :=
918918
inferInstance
919919

920-
instance (priority := low) [AddCommMonoid α] [Module R' α] {S' : Type*} [SetLike S' R']
921-
[SubsemiringClass S' R'] (s : S') : Module s α where
922-
add_smul r₁ r₂ := add_smul (r₁ : R') r₂
923-
zero_smul := zero_smul R'
924-
925920
/-- The action by a subsemiring is the action by the underlying semiring. -/
926921
instance mulDistribMulAction [Monoid α] [MulDistribMulAction R' α] (S : Subsemiring R') :
927922
MulDistribMulAction S α :=

Mathlib/AlgebraicGeometry/Limits.lean

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,10 +457,6 @@ instance : PreservesColimitsOfShape (Discrete PEmpty.{1}) Scheme.Spec.{u} := by
457457
instance {J : Type*} [Finite J] : PreservesColimitsOfShape (Discrete J) Scheme.Spec.{u} :=
458458
preservesFiniteCoproductsOfPreservesBinaryAndInitial _ _
459459

460-
instance {J : Type*} [Finite J] : PreservesColimitsOfShape (Discrete J) Scheme.Spec.{u} :=
461-
letI := (nonempty_fintype J).some
462-
preservesColimitsOfShape_of_equiv (Discrete.equivalence (Fintype.equivFin _).symm) _
463-
464460
/-- The canonical map `∐ Spec Rᵢ ⟶ Spec (Π Rᵢ)`.
465461
This is an isomorphism when the product is finite. -/
466462
noncomputable

Mathlib/AlgebraicGeometry/OpenImmersion.lean

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ of LocallyRingedSpaces
3434
abbrev IsOpenImmersion : MorphismProperty (Scheme.{u}) :=
3535
fun _ _ f ↦ LocallyRingedSpace.IsOpenImmersion f.toLRSHom
3636

37-
instance : IsOpenImmersion.IsStableUnderComposition where
38-
comp_mem f g := fun _ _ ↦ LocallyRingedSpace.IsOpenImmersion.comp f.toLRSHom g.toLRSHom
39-
4037
instance IsOpenImmersion.comp {X Y Z : Scheme.{u}} (f : X ⟶ Y) (g : Y ⟶ Z)
4138
[IsOpenImmersion f] [IsOpenImmersion g] : IsOpenImmersion (f ≫ g) :=
4239
LocallyRingedSpace.IsOpenImmersion.comp f.toLRSHom g.toLRSHom

Mathlib/CategoryTheory/Countable.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ end CountableCategory
7979

8080
instance (α : Type*) [Category α] [FinCategory α] : CountableCategory α where
8181

82-
instance : CountableCategory ℕ where
83-
8482
open Opposite
8583

8684
/-- The opposite of a countable category is countable. -/

0 commit comments

Comments
 (0)