@@ -66,9 +66,9 @@ assert_not_exists IsOrderedRing
6666
6767universe u v w
6868
69- variable {R : Type u} {S : Type v} {T : Type w} [Ring R]
69+ variable {R : Type u} {S : Type v} {T : Type w} [NonAssocRing R]
7070
71- variable [Ring S] [Ring T]
71+ variable [NonAssocRing S] [NonAssocRing T]
7272
7373namespace Subring
7474variable {s t : Subring R}
@@ -115,8 +115,8 @@ namespace Subring
115115variable (s : Subring R)
116116
117117/-- Product of a list of elements in a subring is in the subring. -/
118- protected theorem list_prod_mem {l : List R} : (∀ x ∈ l, x ∈ s) → l.prod ∈ s :=
119- list_prod_mem
118+ protected theorem list_prod_mem {R} [Ring R] (s : Subring R) {l : List R} :
119+ (∀ x ∈ l, x ∈ s) → l.prod ∈ s := list_prod_mem
120120
121121/-- Sum of a list of elements in a subring is in the subring. -/
122122protected theorem list_sum_mem {l : List R} : (∀ x ∈ l, x ∈ s) → l.sum ∈ s :=
@@ -174,17 +174,17 @@ theorem coe_top : ((⊤ : Subring R) : Set R) = Set.univ :=
174174def topEquiv : (⊤ : Subring R) ≃+* R :=
175175 Subsemiring.topEquiv
176176
177- instance {R : Type*} [Ring R] [Fintype R] : Fintype (⊤ : Subring R) :=
177+ instance {R : Type*} [NonAssocRing R] [Fintype R] : Fintype (⊤ : Subring R) :=
178178 (inferInstance : Fintype (⊤ : Set R))
179179
180- theorem card_top (R) [Ring R] [Fintype R] : Fintype.card (⊤ : Subring R) = Fintype.card R :=
180+ theorem card_top (R) [NonAssocRing R] [Fintype R] : Fintype.card (⊤ : Subring R) = Fintype.card R :=
181181 Fintype.card_congr topEquiv.toEquiv
182182
183183/-! ## comap -/
184184
185185
186186/-- The preimage of a subring along a ring homomorphism is a subring. -/
187- def comap {R : Type u} {S : Type v} [Ring R] [Ring S] (f : R →+* S) (s : Subring S) : Subring R :=
187+ def comap (f : R →+* S) (s : Subring S) : Subring R :=
188188 { s.toSubmonoid.comap (f : R →* S), s.toAddSubgroup.comap (f : R →+ S) with
189189 carrier := f ⁻¹' s.carrier }
190190
@@ -204,7 +204,7 @@ theorem comap_comap (s : Subring T) (g : S →+* T) (f : R →+* S) :
204204
205205
206206/-- The image of a subring along a ring homomorphism is a subring. -/
207- def map {R : Type u} {S : Type v} [Ring R] [Ring S] (f : R →+* S) (s : Subring R) : Subring S :=
207+ def map (f : R →+* S) (s : Subring R) : Subring S :=
208208 { s.toSubmonoid.map (f : R →* S), s.toAddSubgroup.map (f : R →+ S) with
209209 carrier := f '' s.carrier }
210210
@@ -250,7 +250,7 @@ variable (g : S →+* T) (f : R →+* S)
250250
251251
252252/-- The range of a ring homomorphism, as a subring of the target. See Note [range copy pattern]. -/
253- def range {R : Type u} {S : Type v} [Ring R] [Ring S] (f : R →+* S) : Subring S :=
253+ def range (f : R →+* S) : Subring S :=
254254 ((⊤ : Subring R).map f).copy (Set.range f) Set.image_univ.symm
255255
256256@[simp]
@@ -384,18 +384,18 @@ theorem center_toSubsemiring : (center R).toSubsemiring = Subsemiring.center R :
384384
385385variable {R}
386386
387- theorem mem_center_iff {z : R} : z ∈ center R ↔ ∀ g, g * z = z * g :=
387+ theorem mem_center_iff {R : Type *} [Ring R] { z : R} : z ∈ center R ↔ ∀ g, g * z = z * g :=
388388 Subsemigroup.mem_center_iff
389389
390- instance decidableMemCenter [DecidableEq R] [Fintype R] : DecidablePred (· ∈ center R) := fun _ =>
391- decidable_of_iff' _ mem_center_iff
390+ instance decidableMemCenter {R} [Ring R] [DecidableEq R] [Fintype R] :
391+ DecidablePred (· ∈ center R) := fun _ => decidable_of_iff' _ mem_center_iff
392392
393393@[simp]
394394theorem center_eq_top (R) [CommRing R] : center R = ⊤ :=
395395 SetLike.coe_injective (Set.center_eq_univ R)
396396
397397/-- The center is commutative. -/
398- instance : CommRing (center R) :=
398+ instance {R} [Ring R] : CommRing (center R) :=
399399 { (inferInstance : CommSemiring (Subsemiring.center R)), (center R).toRing with }
400400
401401/-- The center of isomorphic (not necessarily associative) rings are isomorphic. -/
@@ -438,40 +438,40 @@ end DivisionRing
438438section Centralizer
439439
440440/-- The centralizer of a set inside a ring as a `Subring`. -/
441- def centralizer (s : Set R) : Subring R :=
441+ def centralizer {R} [Ring R] (s : Set R) : Subring R :=
442442 { Subsemiring.centralizer s with neg_mem' := Set.neg_mem_centralizer }
443443
444444@ [simp, norm_cast]
445- theorem coe_centralizer (s : Set R) : (centralizer s : Set R) = s.centralizer :=
445+ theorem coe_centralizer {R} [Ring R] (s : Set R) : (centralizer s : Set R) = s.centralizer :=
446446 rfl
447447
448- theorem centralizer_toSubmonoid (s : Set R) :
448+ theorem centralizer_toSubmonoid {R} [Ring R] (s : Set R) :
449449 (centralizer s).toSubmonoid = Submonoid.centralizer s :=
450450 rfl
451451
452- theorem centralizer_toSubsemiring (s : Set R) :
452+ theorem centralizer_toSubsemiring {R} [Ring R] (s : Set R) :
453453 (centralizer s).toSubsemiring = Subsemiring.centralizer s :=
454454 rfl
455455
456- theorem centralizer_toNonUnitalSubring (s : Set R) :
456+ theorem centralizer_toNonUnitalSubring {R} [Ring R] (s : Set R) :
457457 (centralizer s).toNonUnitalSubring = NonUnitalSubring.centralizer s :=
458458 rfl
459459
460- theorem mem_centralizer_iff {s : Set R} {z : R} : z ∈ centralizer s ↔ ∀ g ∈ s, g * z = z * g :=
461- Iff.rfl
460+ theorem mem_centralizer_iff {R} [Ring R] { s : Set R} {z : R} :
461+ z ∈ centralizer s ↔ ∀ g ∈ s, g * z = z * g := Iff.rfl
462462
463- theorem center_le_centralizer (s) : center R ≤ centralizer s :=
463+ theorem center_le_centralizer {R} [Ring R] (s) : center R ≤ centralizer s :=
464464 s.center_subset_centralizer
465465
466- theorem centralizer_le (s t : Set R) (h : s ⊆ t) : centralizer t ≤ centralizer s :=
466+ theorem centralizer_le {R} [Ring R] (s t : Set R) (h : s ⊆ t) : centralizer t ≤ centralizer s :=
467467 Set.centralizer_subset h
468468
469469@[simp]
470- theorem centralizer_eq_top_iff_subset {s : Set R} : centralizer s = ⊤ ↔ s ⊆ center R :=
470+ theorem centralizer_eq_top_iff_subset {R} [Ring R] { s : Set R} : centralizer s = ⊤ ↔ s ⊆ center R :=
471471 SetLike.ext'_iff.trans Set.centralizer_eq_top_iff_subset
472472
473473@[simp]
474- theorem centralizer_univ : centralizer Set.univ = center R :=
474+ theorem centralizer_univ {R} [Ring R] : centralizer Set.univ = center R :=
475475 SetLike.ext' (Set.centralizer_univ R)
476476
477477end Centralizer
@@ -589,19 +589,19 @@ theorem mem_closure_iff {s : Set R} {x} :
589589 | add _ _ _ _ h₁ h₂ => exact add_mem h₁ h₂
590590 | neg _ _ h => exact neg_mem h⟩
591591
592- lemma closure_le_centralizer_centralizer (s : Set R) :
592+ lemma closure_le_centralizer_centralizer {R} [Ring R] (s : Set R) :
593593 closure s ≤ centralizer (centralizer s) :=
594594 closure_le.mpr Set.subset_centralizer_centralizer
595595
596596/-- If all elements of `s : Set A` commute pairwise, then `closure s` is a commutative ring. -/
597- abbrev closureCommRingOfComm {s : Set R} (hcomm : ∀ x ∈ s, ∀ y ∈ s, x * y = y * x) :
597+ abbrev closureCommRingOfComm {R} [Ring R] { s : Set R} (hcomm : ∀ x ∈ s, ∀ y ∈ s, x * y = y * x) :
598598 CommRing (closure s) :=
599599 { (closure s).toRing with
600600 mul_comm := fun ⟨_, h₁⟩ ⟨_, h₂⟩ ↦
601601 have := closure_le_centralizer_centralizer s
602602 Subtype.ext <| Set.centralizer_centralizer_comm_of_comm hcomm _ (this h₁) _ (this h₂) }
603603
604- theorem exists_list_of_mem_closure {s : Set R} {x : R} (hx : x ∈ closure s) :
604+ theorem exists_list_of_mem_closure {R} [Ring R] { s : Set R} {x : R} (hx : x ∈ closure s) :
605605 ∃ L : List (List R), (∀ t ∈ L, ∀ y ∈ t, y ∈ s ∨ y = (-1 : R)) ∧ (L.map List.prod).sum = x := by
606606 rw [mem_closure_iff] at hx
607607 induction hx using AddSubgroup.closure_induction with
@@ -962,7 +962,8 @@ namespace Subring
962962variable {s : Set R}
963963
964964@[elab_as_elim]
965- protected theorem InClosure.recOn {C : R → Prop } {x : R} (hx : x ∈ closure s) (h1 : C 1 )
965+ protected theorem InClosure.recOn {R} [Ring R] {s : Set R}
966+ {C : R → Prop } {x : R} (hx : x ∈ closure s) (h1 : C 1 )
966967 (hneg1 : C (-1 )) (hs : ∀ z ∈ s, ∀ n, C n → C (z * n)) (ha : ∀ {x y}, C x → C y → C (x + y)) :
967968 C x := by
968969 have h0 : C 0 := add_neg_cancel (1 : R) ▸ ha h1 hneg1
@@ -1055,48 +1056,48 @@ instance [SMul R α] [FaithfulSMul R α] (S : Subring R) : FaithfulSMul S α :=
10551056 (inferInstance : FaithfulSMul S.toSubsemiring α)
10561057
10571058/-- The action by a subring is the action by the underlying ring. -/
1058- instance [MulAction R α] (S : Subring R) : MulAction S α :=
1059+ instance {R} [Ring R] [MulAction R α] (S : Subring R) : MulAction S α :=
10591060 (inferInstance : MulAction S.toSubsemiring α)
10601061
10611062/-- The action by a subring is the action by the underlying ring. -/
1062- instance [ AddMonoid α] [DistribMulAction R α] (S : Subring R) : DistribMulAction S α :=
1063- (inferInstance : DistribMulAction S.toSubsemiring α)
1063+ instance {R} [Ring R] [ AddMonoid α] [DistribMulAction R α] (S : Subring R) :
1064+ DistribMulAction S α := (inferInstance : DistribMulAction S.toSubsemiring α)
10641065
10651066/-- The action by a subring is the action by the underlying ring. -/
1066- instance [ Monoid α] [MulDistribMulAction R α] (S : Subring R) : MulDistribMulAction S α :=
1067- (inferInstance : MulDistribMulAction S.toSubsemiring α)
1067+ instance {R} [Ring R] [ Monoid α] [MulDistribMulAction R α] (S : Subring R) :
1068+ MulDistribMulAction S α := (inferInstance : MulDistribMulAction S.toSubsemiring α)
10681069
10691070/-- The action by a subring is the action by the underlying ring. -/
10701071instance [Zero α] [SMulWithZero R α] (S : Subring R) : SMulWithZero S α :=
10711072 (inferInstance : SMulWithZero S.toSubsemiring α)
10721073
10731074/-- The action by a subring is the action by the underlying ring. -/
1074- instance [Zero α] [MulActionWithZero R α] (S : Subring R) : MulActionWithZero S α :=
1075+ instance {R} [Ring R] [Zero α] [MulActionWithZero R α] (S : Subring R) : MulActionWithZero S α :=
10751076 (inferInstance : MulActionWithZero S.toSubsemiring α)
10761077
10771078/-- The action by a subring is the action by the underlying ring. -/
1078- instance [AddCommMonoid α] [Module R α] (S : Subring R) : Module S α :=
1079+ instance {R} [Ring R] [AddCommMonoid α] [Module R α] (S : Subring R) : Module S α :=
10791080 (inferInstance : Module S.toSubsemiring α)
10801081
10811082/-- The action by a subsemiring is the action by the underlying ring. -/
1082- instance [ Semiring α] [MulSemiringAction R α] (S : Subring R) : MulSemiringAction S α :=
1083- (inferInstance : MulSemiringAction S.toSubmonoid α)
1083+ instance {R} [Ring R] [ Semiring α] [MulSemiringAction R α] (S : Subring R) :
1084+ MulSemiringAction S α := (inferInstance : MulSemiringAction S.toSubmonoid α)
10841085
10851086/-- The center of a semiring acts commutatively on that semiring. -/
1086- instance center.smulCommClass_left : SMulCommClass (center R) R R :=
1087+ instance center.smulCommClass_left {R} [Ring R] : SMulCommClass (center R) R R :=
10871088 Subsemiring.center.smulCommClass_left
10881089
10891090/-- The center of a semiring acts commutatively on that semiring. -/
1090- instance center.smulCommClass_right : SMulCommClass R (center R) R :=
1091+ instance center.smulCommClass_right {R} [Ring R] : SMulCommClass R (center R) R :=
10911092 Subsemiring.center.smulCommClass_right
10921093
10931094/-- The center of a semiring acts commutatively on any `R`-module -/
1094- instance {M : Type*} [MulAction R M] :
1095+ instance {R M : Type*} [Ring R] [MulAction R M] :
10951096 SMulCommClass R (Subring.center R) M :=
10961097 (inferInstance : SMulCommClass R (Submonoid.center R) M)
10971098
10981099/-- The center of a semiring acts commutatively on any `R`-module -/
1099- instance {M : Type*} [MulAction R M] :
1100+ instance {R M : Type*} [Ring R] [MulAction R M] :
11001101 SMulCommClass (Subring.center R) R M :=
11011102 (inferInstance : SMulCommClass (Submonoid.center R) R M)
11021103
0 commit comments