@@ -252,6 +252,13 @@ theorem coe_one : (↑(1 : R) : c.Quotient) = 1 :=
252252
253253end One
254254
255+ /-- A function used to define scalar actions on `RingCon.Quotient`. To make sure such actions coming
256+ from different sources are reducibly defeq, they should all go through this function. -/
257+ def smulAux [Add R] [Mul R] {α : Type *} [SMul α R]
258+ (c : RingCon R) (h : ∀ (a : α) (x y : R), c x y → c (a • x) (a • y))
259+ (a : α) (x : c.Quotient) : c.Quotient :=
260+ Quotient.map' (a • ·) (h a) x
261+
255262section NegSubZSMul
256263
257264variable [AddGroup R] [Mul R] (c : RingCon R)
@@ -268,7 +275,7 @@ instance : Sub c.Quotient := inferInstanceAs (Sub c.toAddCon.Quotient)
268275theorem coe_sub (x y : R) : (↑(x - y) : c.Quotient) = x - y :=
269276 rfl
270277
271- instance hasZSMul : SMul ℤ c.Quotient := inferInstanceAs (SMul ℤ c.toAddCon.Quotient)
278+ instance hasZSMul : SMul ℤ c.Quotient := ⟨c.smulAux (RingCon.zsmul c)⟩
272279
273280@ [simp, norm_cast]
274281theorem coe_zsmul (z : ℤ) (x : R) : (↑(z • x) : c.Quotient) = z • (x : c.Quotient) :=
@@ -280,7 +287,7 @@ section NSMul
280287
281288variable [AddMonoid R] [Mul R] (c : RingCon R)
282289
283- instance hasNSMul : SMul ℕ c.Quotient := inferInstanceAs (SMul ℕ c.toAddCon.Quotient)
290+ instance hasNSMul : SMul ℕ c.Quotient := ⟨c.smulAux (RingCon.nsmul c)⟩
284291
285292@ [simp, norm_cast]
286293theorem coe_nsmul (n : ℕ) (x : R) : (↑(n • x) : c.Quotient) = n • (x : c.Quotient) :=
@@ -353,14 +360,16 @@ instance [AddCommMagma R] [Mul R] (c : RingCon R) : AddCommMagma c.Quotient :=
353360instance [AddCommSemigroup R] [Mul R] (c : RingCon R) : AddCommSemigroup c.Quotient :=
354361 inferInstanceAs <| AddCommSemigroup c.toAddCon.Quotient
355362
356- instance [AddMonoid R] [Mul R] (c : RingCon R) : AddMonoid c.Quotient :=
357- inferInstanceAs <| AddMonoid c.toAddCon.Quotient
363+ instance [AddMonoid R] [Mul R] (c : RingCon R) : AddMonoid c.Quotient where
364+ nsmul n x := n • x
365+ __ : AddMonoid c.Quotient := inferInstanceAs <| AddMonoid c.toAddCon.Quotient
358366
359367instance [AddCommMonoid R] [Mul R] (c : RingCon R) : AddCommMonoid c.Quotient :=
360368 inferInstanceAs <| AddCommMonoid c.toAddCon.Quotient
361369
362- instance [AddGroup R] [Mul R] (c : RingCon R) : AddGroup c.Quotient :=
363- inferInstanceAs <| AddGroup c.toAddCon.Quotient
370+ instance [AddGroup R] [Mul R] (c : RingCon R) : AddGroup c.Quotient where
371+ zsmul n x := n • x
372+ __ : AddGroup c.Quotient := inferInstanceAs <| AddGroup c.toAddCon.Quotient
364373
365374instance [AddCommGroup R] [Mul R] (c : RingCon R) : AddCommGroup c.Quotient :=
366375 inferInstanceAs <| AddCommGroup c.toAddCon.Quotient
0 commit comments