Skip to content

Commit bce0198

Browse files
committed
chore: mark toSubfield, toSubmodule, toSubring as reducible (#36395)
This PR marks `IntermediateField.toSubfield`, `Subalgebra.toSubring` and `Subalgebra.toSubmodule` as `implicit_reducible`, because these are all used to construct instances on substructures, and hence need to be reducible when unifying type classes. This allows removing at least 100 backwards compatability flags (possibly more because I haven't checked these exhaustively)
1 parent c0ae7a0 commit bce0198

File tree

9 files changed

+10
-112
lines changed

9 files changed

+10
-112
lines changed

Mathlib/Algebra/Algebra/Subalgebra/Basic.lean

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,17 +240,15 @@ def toAddSubmonoid {R : Type u} {A : Type v} [CommSemiring R] [Semiring A] [Alge
240240
S.toSubsemiring.toAddSubmonoid
241241

242242
/-- A subalgebra over a ring is also a `Subring`. -/
243-
@[simps toSubsemiring]
243+
@[reducible]
244244
def toSubring {R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A] (S : Subalgebra R A) :
245245
Subring A :=
246246
{ S.toSubsemiring with neg_mem' := S.neg_mem }
247247

248-
@[simp]
249248
theorem mem_toSubring {R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A]
250249
{S : Subalgebra R A} {x} : x ∈ S.toSubring ↔ x ∈ S :=
251250
Iff.rfl
252251

253-
@[simp]
254252
theorem coe_toSubring {R : Type u} {A : Type v} [CommRing R] [Ring A] [Algebra R A]
255253
(S : Subalgebra R A) : (↑S.toSubring : Set A) = S :=
256254
rfl
@@ -289,6 +287,7 @@ instance toCommRing {R A} [CommRing R] [CommRing A] [Algebra R A] (S : Subalgebr
289287
end
290288

291289
/-- The forgetful map from `Subalgebra` to `Submodule` as an `OrderEmbedding` -/
290+
@[implicit_reducible] -- Not `@[reducible]` because it is an order embedding rather than a function.
292291
def toSubmodule : Subalgebra R A ↪o Submodule R A where
293292
toEmbedding :=
294293
{ toFun := fun S =>

Mathlib/Algebra/Algebra/Subalgebra/Lattice.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ variable (R : Type u) {A : Type v} {B : Type w}
2828
variable [CommSemiring R] [Semiring A] [Algebra R A] [Semiring B] [Algebra R B]
2929

3030
/-- The minimal subalgebra that includes `s`. -/
31-
@[simps toSubsemiring]
31+
@[simps -isSimp toSubsemiring]
3232
def adjoin (s : Set A) : Subalgebra R A :=
3333
{ Subsemiring.closure (Set.range (algebraMap R A) ∪ s) with
3434
algebraMap_mem' := fun r => Subsemiring.subset_closure <| Or.inl ⟨r, rfl⟩ }

Mathlib/FieldTheory/IntermediateField/Adjoin/Basic.lean

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,16 @@ set_option backward.isDefEq.respectTransparency false in
291291
@[simp] theorem rank_bot' : Module.rank (⊥ : IntermediateField F E) E = Module.rank F E := by
292292
rw [← rank_mul_rank F (⊥ : IntermediateField F E) E, IntermediateField.rank_bot, one_mul]
293293

294-
@[simp] theorem finrank_bot' : finrank (⊥ : IntermediateField F E) E = finrank F E :=
294+
@[simp, nolint simpNF] -- `simpNF` hits a (deterministic) timeout at `typeclass`
295+
theorem finrank_bot' : finrank (⊥ : IntermediateField F E) E = finrank F E :=
295296
congr(Cardinal.toNat $(rank_bot'))
296297

297298
set_option backward.isDefEq.respectTransparency false in
298299
@[simp] protected theorem rank_top : Module.rank (⊤ : IntermediateField F E) E = 1 :=
299300
Subalgebra.bot_eq_top_iff_rank_eq_one.mp <| top_le_iff.mp fun x _ ↦ ⟨⟨x, trivial⟩, rfl⟩
300301

301-
@[simp] protected theorem finrank_top : finrank (⊤ : IntermediateField F E) E = 1 :=
302+
@[simp, nolint simpNF] -- `simpNF` hits a (deterministic) timeout at `typeclass`
303+
protected theorem finrank_top : finrank (⊤ : IntermediateField F E) E = 1 :=
302304
rank_eq_one_iff_finrank_eq_one.mp IntermediateField.rank_top
303305

304306
@[simp] theorem rank_top' : Module.rank F (⊤ : IntermediateField F E) = Module.rank F E :=

Mathlib/FieldTheory/IntermediateField/Basic.lean

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ protected theorem neg_mem {x : L} (hx : x ∈ S) : -x ∈ S := by
7070
change -x ∈ S.toSubalgebra; simpa
7171

7272
/-- Reinterpret an `IntermediateField` as a `Subfield`. -/
73+
@[reducible]
7374
def toSubfield : Subfield L :=
7475
{ S.toSubalgebra with
7576
neg_mem' := S.neg_mem,
@@ -116,7 +117,6 @@ theorem mem_mk (s : Subsemiring L) (hK : ∀ x, algebraMap K L x ∈ s) (hi) (x
116117
theorem mem_toSubalgebra (s : IntermediateField K L) (x : L) : x ∈ s.toSubalgebra ↔ x ∈ s :=
117118
Iff.rfl
118119

119-
@[simp]
120120
theorem mem_toSubfield (s : IntermediateField K L) (x : L) : x ∈ s.toSubfield ↔ x ∈ s :=
121121
Iff.rfl
122122

@@ -620,7 +620,6 @@ variable {F E : IntermediateField K L}
620620
@[simp]
621621
theorem toSubalgebra_inj : F.toSubalgebra = E.toSubalgebra ↔ F = E := toSubalgebra_injective.eq_iff
622622

623-
@[simp]
624623
theorem toSubfield_inj : F.toSubfield = E.toSubfield ↔ F = E := toSubfield_injective.eq_iff
625624

626625
theorem map_injective (f : L →ₐ[K] L') : Function.Injective (map f) := by
@@ -803,7 +802,7 @@ variable (F)
803802
into an order isomorphism from
804803
`{ E : Subfield L // F ≤ E }` to `IntermediateField F L`. Its inverse is
805804
`IntermediateField.toSubfield`. -/
806-
@[simps]
805+
@[simps apply symm_apply]
807806
def extendScalars.orderIso :
808807
{ E : Subfield L // F ≤ E } ≃o IntermediateField F L where
809808
toFun E := extendScalars E.2

Mathlib/FieldTheory/LinearDisjoint.lean

Lines changed: 0 additions & 47 deletions
Large diffs are not rendered by default.

Mathlib/RingTheory/DedekindDomain/LinearDisjoint.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ and `Frac R` denotes the fraction field of a domain `R`.
3232

3333
open FractionalIdeal nonZeroDivisors IntermediateField Algebra Module Submodule
3434

35-
set_option backward.isDefEq.respectTransparency false
36-
3735
variable (A B : Type*) {K L : Type*} [CommRing A] [Field K] [Algebra A K] [IsFractionRing A K]
3836
[CommRing B] [Field L] [Algebra B L] [Algebra A L] [Algebra K L] [FiniteDimensional K L]
3937
[IsScalarTower A K L]

Mathlib/RingTheory/Ideal/Quotient/HasFiniteQuotients.lean

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,4 @@ instance : HasFiniteQuotients ℤ where
8686
have : NeZero n := ⟨by simpa using hI⟩
8787
exact inferInstanceAs <| Finite (ℤ ⧸ Ideal.span {n})
8888

89-
/-- A domain that is also a finite `ℤ`-module has finite quotients. -/
90-
instance [IsDomain R] [Module.Finite ℤ R] : HasFiniteQuotients R :=
91-
of_module_finite ℤ R
92-
9389
end Ring.HasFiniteQuotients

0 commit comments

Comments
 (0)