Skip to content

Commit a38db99

Browse files
committed
refactor: generalize SMul (Ideal R) (Submodule R M) to SMul (Submodule R A) (Submodule R M) (#18419)
and redefine `Mul (Submodule R A) (Submodule R A)` using the latter.
1 parent bbaf1a0 commit a38db99

2 files changed

Lines changed: 138 additions & 122 deletions

File tree

Mathlib/Algebra/Algebra/Operations.lean

Lines changed: 136 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -93,87 +93,193 @@ theorem one_le {P : Submodule R A} : (1 : Submodule R A) ≤ P ↔ (1 : A) ∈ P
9393
-- Porting note: simpa no longer closes refl goals, so added `SetLike.mem_coe`
9494
simp only [one_eq_span, span_le, Set.singleton_subset_iff, SetLike.mem_coe]
9595

96+
variable {M : Type*} [AddCommMonoid M] [Module R M] [Module A M] [IsScalarTower R A M]
97+
98+
instance : SMul (Submodule R A) (Submodule R M) where
99+
smul A' M' :=
100+
{ __ := A'.toAddSubmonoid • M'.toAddSubmonoid
101+
smul_mem' := fun r m hm ↦ AddSubmonoid.smul_induction_on hm
102+
(fun a ha m hm ↦ by rw [← smul_assoc]; exact AddSubmonoid.smul_mem_smul (A'.smul_mem r ha) hm)
103+
fun m₁ m₂ h₁ h₂ ↦ by rw [smul_add]; exact (A'.1 • M'.1).add_mem h₁ h₂ }
104+
105+
section
106+
107+
variable {I J : Submodule R A} {N P : Submodule R M}
108+
109+
theorem smul_toAddSubmonoid : (I • N).toAddSubmonoid = I.toAddSubmonoid • N.toAddSubmonoid := rfl
110+
111+
theorem smul_mem_smul {r} {n} (hr : r ∈ I) (hn : n ∈ N) : r • n ∈ I • N :=
112+
AddSubmonoid.smul_mem_smul hr hn
113+
114+
theorem smul_le : I • N ≤ P ↔ ∀ r ∈ I, ∀ n ∈ N, r • n ∈ P :=
115+
AddSubmonoid.smul_le
116+
117+
@[simp, norm_cast]
118+
lemma coe_set_smul : (I : Set A) • N = I • N :=
119+
set_smul_eq_of_le _ _ _
120+
(fun _ _ hr hx ↦ smul_mem_smul hr hx)
121+
(smul_le.mpr fun _ hr _ hx ↦ mem_set_smul_of_mem_mem hr hx)
122+
123+
@[elab_as_elim]
124+
theorem smul_induction_on {p : M → Prop} {x} (H : x ∈ I • N) (smul : ∀ r ∈ I, ∀ n ∈ N, p (r • n))
125+
(add : ∀ x y, p x → p y → p (x + y)) : p x :=
126+
AddSubmonoid.smul_induction_on H smul add
127+
128+
/-- Dependent version of `Submodule.smul_induction_on`. -/
129+
@[elab_as_elim]
130+
theorem smul_induction_on' {x : M} (hx : x ∈ I • N) {p : ∀ x, x ∈ I • N → Prop}
131+
(smul : ∀ (r : A) (hr : r ∈ I) (n : M) (hn : n ∈ N), p (r • n) (smul_mem_smul hr hn))
132+
(add : ∀ x hx y hy, p x hx → p y hy → p (x + y) (add_mem ‹_› ‹_›)) : p x hx := by
133+
refine Exists.elim ?_ fun (h : x ∈ I • N) (H : p x h) ↦ H
134+
exact smul_induction_on hx (fun a ha x hx ↦ ⟨_, smul _ ha _ hx⟩)
135+
fun x y ⟨_, hx⟩ ⟨_, hy⟩ ↦ ⟨_, add _ _ _ _ hx hy⟩
136+
137+
theorem smul_mono (hij : I ≤ J) (hnp : N ≤ P) : I • N ≤ J • P :=
138+
AddSubmonoid.smul_le_smul hij hnp
139+
140+
theorem smul_mono_left (h : I ≤ J) : I • N ≤ J • N :=
141+
smul_mono h le_rfl
142+
143+
instance : CovariantClass (Submodule R A) (Submodule R M) HSMul.hSMul LE.le :=
144+
fun _ _ => smul_mono le_rfl⟩
145+
146+
@[deprecated smul_mono_right (since := "2024-03-31")]
147+
protected theorem smul_mono_right (h : N ≤ P) : I • N ≤ I • P :=
148+
_root_.smul_mono_right I h
149+
150+
variable (I J N P)
151+
152+
@[simp]
153+
theorem smul_bot : I • (⊥ : Submodule R M) = ⊥ :=
154+
toAddSubmonoid_injective <| AddSubmonoid.addSubmonoid_smul_bot _
155+
156+
@[simp]
157+
theorem bot_smul : (⊥ : Submodule R A) • N = ⊥ :=
158+
le_bot_iff.mp <| smul_le.mpr <| by rintro _ rfl _ _; rw [zero_smul]; exact zero_mem _
159+
160+
theorem smul_sup : I • (N ⊔ P) = I • N ⊔ I • P :=
161+
toAddSubmonoid_injective <| by
162+
simp only [smul_toAddSubmonoid, sup_toAddSubmonoid, AddSubmonoid.addSubmonoid_smul_sup]
163+
164+
theorem sup_smul : (I ⊔ J) • N = I • N ⊔ J • N :=
165+
le_antisymm (smul_le.mpr fun mn hmn p hp ↦ by
166+
obtain ⟨m, hm, n, hn, rfl⟩ := mem_sup.mp hmn
167+
rw [add_smul]; exact add_mem_sup (smul_mem_smul hm hp) <| smul_mem_smul hn hp)
168+
(sup_le (smul_mono_left le_sup_left) <| smul_mono_left le_sup_right)
169+
170+
protected theorem smul_assoc {B} [Semiring B] [Module R B] [Module A B] [Module B M]
171+
[IsScalarTower R A B] [IsScalarTower R B M] [IsScalarTower A B M]
172+
(I : Submodule R A) (J : Submodule R B) (N : Submodule R M) :
173+
(I • J) • N = I • J • N :=
174+
le_antisymm
175+
(smul_le.2 fun _ hrsij t htn ↦ smul_induction_on hrsij
176+
(fun r hr s hs ↦ smul_assoc r s t ▸ smul_mem_smul hr (smul_mem_smul hs htn))
177+
fun x y ↦ (add_smul x y t).symm ▸ add_mem)
178+
(smul_le.2 fun r hr _ hsn ↦ smul_induction_on hsn
179+
(fun j hj n hn ↦ (smul_assoc r j n).symm ▸ smul_mem_smul (smul_mem_smul hr hj) hn)
180+
fun m₁ m₂ ↦ (smul_add r m₁ m₂) ▸ add_mem)
181+
182+
@[deprecated smul_inf_le (since := "2024-03-31")]
183+
protected theorem smul_inf_le (M₁ M₂ : Submodule R M) :
184+
I • (M₁ ⊓ M₂) ≤ I • M₁ ⊓ I • M₂ := smul_inf_le _ _ _
185+
186+
theorem smul_iSup {ι : Sort*} {I : Submodule R A} {t : ι → Submodule R M} :
187+
I • (⨆ i, t i)= ⨆ i, I • t i :=
188+
toAddSubmonoid_injective <| by
189+
simp only [smul_toAddSubmonoid, iSup_toAddSubmonoid, AddSubmonoid.smul_iSup]
190+
191+
theorem iSup_smul {ι : Sort*} {t : ι → Submodule R A} {N : Submodule R M} :
192+
(⨆ i, t i) • N = ⨆ i, t i • N :=
193+
le_antisymm (smul_le.mpr fun t ht s hs ↦ iSup_induction _ (C := (· • s ∈ _)) ht
194+
(fun i t ht ↦ mem_iSup_of_mem i <| smul_mem_smul ht hs)
195+
(by simp_rw [zero_smul]; apply zero_mem) fun x y ↦ by simp_rw [add_smul]; apply add_mem)
196+
(iSup_le fun i ↦ Submodule.smul_mono_left <| le_iSup _ i)
197+
198+
@[deprecated smul_iInf_le (since := "2024-03-31")]
199+
protected theorem smul_iInf_le {ι : Sort*} {I : Submodule R A} {t : ι → Submodule R M} :
200+
I • iInf t ≤ ⨅ i, I • t i :=
201+
smul_iInf_le
202+
203+
protected theorem one_smul : (1 : Submodule R A) • N = N := by
204+
refine le_antisymm (smul_le.mpr fun r hr m hm ↦ ?_) fun m hm ↦ ?_
205+
· obtain ⟨r, rfl⟩ := hr
206+
rw [LinearMap.toSpanSingleton_apply, smul_one_smul]; exact N.smul_mem r hm
207+
· rw [← one_smul A m]; exact smul_mem_smul (one_le.mp le_rfl) hm
208+
209+
theorem smul_subset_smul : (↑I : Set A) • (↑N : Set M) ⊆ (↑(I • N) : Set M) :=
210+
AddSubmonoid.smul_subset_smul
211+
212+
end
213+
96214
variable [IsScalarTower R A A]
97215

98216
/-- Multiplication of sub-R-modules of an R-module A that is also a semiring. The submodule `M * N`
99217
consists of finite sums of elements `m * n` for `m ∈ M` and `n ∈ N`. -/
100218
instance mul : Mul (Submodule R A) where
101-
mul M N :=
102-
{ __ := M.toAddSubmonoid * N.toAddSubmonoid
103-
smul_mem' := fun r a ha ↦ AddSubmonoid.mul_induction_on ha
104-
(fun m h n h' ↦ by rw [← smul_mul_assoc]; exact AddSubmonoid.mul_mem_mul (M.smul_mem r h) h')
105-
fun a₁ a₂ h₁ h₂ ↦ by rw [smul_add]; apply (M.1 * N.1).add_mem h₁ h₂ }
219+
mul := (· • ·)
106220

107221
variable (S T : Set A) {M N P Q : Submodule R A} {m n : A}
108222

109223
theorem mul_mem_mul (hm : m ∈ M) (hn : n ∈ N) : m * n ∈ M * N :=
110-
AddSubmonoid.mul_mem_mul hm hn
224+
smul_mem_smul hm hn
111225

112226
theorem mul_le : M * N ≤ P ↔ ∀ m ∈ M, ∀ n ∈ N, m * n ∈ P :=
113-
AddSubmonoid.mul_le
227+
smul_le
114228

115229
theorem mul_toAddSubmonoid (M N : Submodule R A) :
116230
(M * N).toAddSubmonoid = M.toAddSubmonoid * N.toAddSubmonoid := rfl
117231

118232
@[elab_as_elim]
119233
protected theorem mul_induction_on {C : A → Prop} {r : A} (hr : r ∈ M * N)
120234
(hm : ∀ m ∈ M, ∀ n ∈ N, C (m * n)) (ha : ∀ x y, C x → C y → C (x + y)) : C r :=
121-
AddSubmonoid.mul_induction_on hr hm ha
235+
smul_induction_on hr hm ha
122236

123237
/-- A dependent version of `mul_induction_on`. -/
124238
@[elab_as_elim]
125239
protected theorem mul_induction_on' {C : ∀ r, r ∈ M * N → Prop}
126240
(mem_mul_mem : ∀ m (hm : m ∈ M) n (hn : n ∈ N), C (m * n) (mul_mem_mul hm hn))
127241
(add : ∀ x hx y hy, C x hx → C y hy → C (x + y) (add_mem hx hy)) {r : A} (hr : r ∈ M * N) :
128-
C r hr := by
129-
refine Exists.elim ?_ fun (hr : r ∈ M * N) (hc : C r hr) ↦ hc
130-
exact Submodule.mul_induction_on hr
131-
(fun x hx y hy ↦ ⟨_, mem_mul_mem _ hx _ hy⟩)
132-
fun x y ⟨_, hx⟩ ⟨_, hy⟩ ↦ ⟨_, add _ _ _ _ hx hy⟩
242+
C r hr :=
243+
smul_induction_on' hr mem_mul_mem add
133244

134245
variable (M)
135246

136247
@[simp]
137248
theorem mul_bot : M * ⊥ = ⊥ :=
138-
toAddSubmonoid_injective (AddSubmonoid.mul_bot _)
249+
smul_bot _
139250

140251
@[simp]
141252
theorem bot_mul : ⊥ * M = ⊥ :=
142-
toAddSubmonoid_injective (AddSubmonoid.bot_mul _)
253+
bot_smul _
143254

144-
protected theorem one_mul : (1 : Submodule R A) * M = M := by
145-
refine le_antisymm (mul_le.mpr fun r hr m hm ↦ ?_) fun m hm ↦ ?_
146-
· obtain ⟨r, rfl⟩ := hr
147-
rw [LinearMap.toSpanSingleton_apply, smul_one_mul]; exact M.smul_mem r hm
148-
· rw [← one_mul m]; exact mul_mem_mul (one_le.mp le_rfl) hm
255+
protected theorem one_mul : (1 : Submodule R A) * M = M :=
256+
Submodule.one_smul _
149257

150258
variable {M}
151259

152260
@[mono]
153261
theorem mul_le_mul (hmp : M ≤ P) (hnq : N ≤ Q) : M * N ≤ P * Q :=
154-
AddSubmonoid.mul_le_mul hmp hnq
262+
smul_mono hmp hnq
155263

156264
theorem mul_le_mul_left (h : M ≤ N) : M * P ≤ N * P :=
157-
AddSubmonoid.mul_le_mul_left h
265+
smul_mono_left h
158266

159267
theorem mul_le_mul_right (h : N ≤ P) : M * N ≤ M * P :=
160-
AddSubmonoid.mul_le_mul_right h
268+
smul_mono_right _ h
161269

162270
theorem mul_comm_of_commute (h : ∀ m ∈ M, ∀ n ∈ N, Commute m n) : M * N = N * M :=
163271
toAddSubmonoid_injective <| AddSubmonoid.mul_comm_of_commute h
164272

165273
variable (M N P)
166274

167275
theorem mul_sup : M * (N ⊔ P) = M * N ⊔ M * P :=
168-
toAddSubmonoid_injective <| by
169-
simp only [mul_toAddSubmonoid, sup_toAddSubmonoid, AddSubmonoid.mul_sup]
276+
smul_sup _ _ _
170277

171278
theorem sup_mul : (M ⊔ N) * P = M * P ⊔ N * P :=
172-
toAddSubmonoid_injective <| by
173-
simp only [mul_toAddSubmonoid, sup_toAddSubmonoid, AddSubmonoid.sup_mul]
279+
sup_smul _ _ _
174280

175281
theorem mul_subset_mul : (↑M : Set A) * (↑N : Set A) ⊆ (↑(M * N) : Set A) :=
176-
AddSubmonoid.mul_subset_mul
282+
smul_subset_smul _ _
177283

178284
lemma restrictScalars_mul {A B C} [Semiring A] [Semiring B] [Semiring C]
179285
[SMul A B] [Module A C] [Module B C] [IsScalarTower A C C] [IsScalarTower B C C]
@@ -184,12 +290,10 @@ lemma restrictScalars_mul {A B C} [Semiring A] [Semiring B] [Semiring C]
184290
variable {ι : Sort uι}
185291

186292
theorem iSup_mul (s : ι → Submodule R A) (t : Submodule R A) : (⨆ i, s i) * t = ⨆ i, s i * t :=
187-
toAddSubmonoid_injective <| by
188-
simp only [mul_toAddSubmonoid, iSup_toAddSubmonoid, AddSubmonoid.iSup_mul]
293+
iSup_smul
189294

190295
theorem mul_iSup (t : Submodule R A) (s : ι → Submodule R A) : (t * ⨆ i, s i) = ⨆ i, t * s i :=
191-
toAddSubmonoid_injective <| by
192-
simp only [mul_toAddSubmonoid, iSup_toAddSubmonoid, AddSubmonoid.mul_iSup]
296+
smul_iSup
193297

194298
/-- Sub-`R`-modules of an `R`-module form an idempotent semiring. -/
195299
instance : NonUnitalSemiring (Submodule R A) where

Mathlib/RingTheory/Ideal/Operations.lean

Lines changed: 2 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -56,116 +56,28 @@ section Semiring
5656

5757
variable [Semiring R] [AddCommMonoid M] [Module R M]
5858

59-
instance : SMul (Ideal R) (Submodule R M) where
60-
smul I N :=
61-
{ __ := I.toAddSubmonoid • N.toAddSubmonoid
62-
smul_mem' := fun r m hm ↦ AddSubmonoid.smul_induction_on hm
63-
(fun m hm n ↦ by rw [smul_smul]; exact AddSubmonoid.smul_mem_smul <| I.smul_mem _ hm)
64-
fun m₁ m₂ h₁ h₂ ↦ by rw [smul_add]; exact (I.1 • N.1).add_mem h₁ h₂ }
65-
6659
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
6760
apply. -/
6861
protected theorem _root_.Ideal.smul_eq_mul (I J : Ideal R) : I • J = I * J :=
6962
rfl
7063

71-
variable {I J : Ideal R} {N P : Submodule R M}
72-
73-
theorem smul_toAddSubmonoid : (I • N).toAddSubmonoid = I.toAddSubmonoid • N.toAddSubmonoid := rfl
74-
75-
theorem smul_mem_smul {r} {n} (hr : r ∈ I) (hn : n ∈ N) : r • n ∈ I • N :=
76-
AddSubmonoid.smul_mem_smul hr hn
77-
78-
theorem smul_le : I • N ≤ P ↔ ∀ r ∈ I, ∀ n ∈ N, r • n ∈ P :=
79-
AddSubmonoid.smul_le
80-
81-
@[simp, norm_cast]
82-
lemma coe_set_smul : (I : Set R) • N = I • N :=
83-
set_smul_eq_of_le _ _ _
84-
(fun _ _ hr hx ↦ smul_mem_smul hr hx)
85-
(smul_le.mpr fun _ hr _ hx ↦ mem_set_smul_of_mem_mem hr hx)
86-
87-
@[elab_as_elim]
88-
theorem smul_induction_on {p : M → Prop} {x} (H : x ∈ I • N) (smul : ∀ r ∈ I, ∀ n ∈ N, p (r • n))
89-
(add : ∀ x y, p x → p y → p (x + y)) : p x :=
90-
AddSubmonoid.smul_induction_on H smul add
91-
92-
/-- Dependent version of `Submodule.smul_induction_on`. -/
93-
@[elab_as_elim]
94-
theorem smul_induction_on' {x : M} (hx : x ∈ I • N) {p : ∀ x, x ∈ I • N → Prop}
95-
(smul : ∀ (r : R) (hr : r ∈ I) (n : M) (hn : n ∈ N), p (r • n) (smul_mem_smul hr hn))
96-
(add : ∀ x hx y hy, p x hx → p y hy → p (x + y) (add_mem ‹_› ‹_›)) : p x hx := by
97-
refine Exists.elim ?_ fun (h : x ∈ I • N) (H : p x h) ↦ H
98-
exact smul_induction_on hx (fun a ha x hx ↦ ⟨_, smul _ ha _ hx⟩)
99-
fun x y ⟨_, hx⟩ ⟨_, hy⟩ ↦ ⟨_, add _ _ _ _ hx hy⟩
64+
variable {I : Ideal R} {N : Submodule R M}
10065

10166
theorem smul_le_right : I • N ≤ N :=
10267
smul_le.2 fun r _ _ ↦ N.smul_mem r
10368

104-
theorem smul_mono (hij : I ≤ J) (hnp : N ≤ P) : I • N ≤ J • P :=
105-
AddSubmonoid.smul_le_smul hij hnp
106-
107-
theorem smul_mono_left (h : I ≤ J) : I • N ≤ J • N :=
108-
smul_mono h le_rfl
109-
110-
instance : CovariantClass (Ideal R) (Submodule R M) HSMul.hSMul LE.le :=
111-
fun _ _ => smul_mono le_rfl⟩
112-
113-
@[deprecated smul_mono_right (since := "2024-03-31")]
114-
protected theorem smul_mono_right (h : N ≤ P) : I • N ≤ I • P :=
115-
_root_.smul_mono_right I h
116-
11769
theorem map_le_smul_top (I : Ideal R) (f : R →ₗ[R] M) :
11870
Submodule.map f I ≤ I • (⊤ : Submodule R M) := by
11971
rintro _ ⟨y, hy, rfl⟩
12072
rw [← mul_one y, ← smul_eq_mul, f.map_smul]
12173
exact smul_mem_smul hy mem_top
12274

123-
variable (I J N P)
124-
125-
@[simp]
126-
theorem smul_bot : I • (⊥ : Submodule R M) = ⊥ :=
127-
toAddSubmonoid_injective <| AddSubmonoid.addSubmonoid_smul_bot _
128-
129-
@[simp]
130-
theorem bot_smul : (⊥ : Ideal R) • N = ⊥ :=
131-
le_bot_iff.mp <| smul_le.mpr <| by rintro _ rfl _ _; rw [zero_smul]; exact zero_mem _
75+
variable (I N)
13276

13377
@[simp]
13478
theorem top_smul : (⊤ : Ideal R) • N = N :=
13579
le_antisymm smul_le_right fun r hri => one_smul R r ▸ smul_mem_smul mem_top hri
13680

137-
theorem smul_sup : I • (N ⊔ P) = I • N ⊔ I • P :=
138-
toAddSubmonoid_injective <| by
139-
simp only [smul_toAddSubmonoid, sup_toAddSubmonoid, AddSubmonoid.addSubmonoid_smul_sup]
140-
141-
theorem sup_smul : (I ⊔ J) • N = I • N ⊔ J • N :=
142-
le_antisymm (smul_le.mpr fun mn hmn p hp ↦ by
143-
obtain ⟨m, hm, n, hn, rfl⟩ := mem_sup.mp hmn
144-
rw [add_smul]; exact add_mem_sup (smul_mem_smul hm hp) <| smul_mem_smul hn hp)
145-
(sup_le (smul_mono_left le_sup_left) <| smul_mono_left le_sup_right)
146-
147-
protected theorem smul_assoc : (I • J) • N = I • J • N :=
148-
le_antisymm
149-
(smul_le.2 fun _ hrsij t htn ↦ smul_induction_on hrsij
150-
(fun r hr s hs ↦ smul_assoc r s t ▸ smul_mem_smul hr (smul_mem_smul hs htn))
151-
fun x y ↦ (add_smul x y t).symm ▸ add_mem)
152-
(smul_le.2 fun r hr _ hsn ↦ smul_induction_on hsn
153-
(fun j hj n hn ↦ (smul_assoc r j n).symm ▸ smul_mem_smul (smul_mem_smul hr hj) hn)
154-
fun m₁ m₂ ↦ (smul_add r m₁ m₂) ▸ add_mem)
155-
156-
@[deprecated smul_inf_le (since := "2024-03-31")]
157-
protected theorem smul_inf_le (M₁ M₂ : Submodule R M) :
158-
I • (M₁ ⊓ M₂) ≤ I • M₁ ⊓ I • M₂ := smul_inf_le _ _ _
159-
160-
theorem smul_iSup {ι : Sort*} {I : Ideal R} {t : ι → Submodule R M} : I • iSup t = ⨆ i, I • t i :=
161-
toAddSubmonoid_injective <| by
162-
simp only [smul_toAddSubmonoid, iSup_toAddSubmonoid, AddSubmonoid.smul_iSup]
163-
164-
@[deprecated smul_iInf_le (since := "2024-03-31")]
165-
protected theorem smul_iInf_le {ι : Sort*} {I : Ideal R} {t : ι → Submodule R M} :
166-
I • iInf t ≤ ⨅ i, I • t i :=
167-
smul_iInf_le
168-
16981
theorem mem_of_span_top_of_smul_mem (M' : Submodule R M) (s : Set R) (hs : Ideal.span s = ⊤) (x : M)
17082
(H : ∀ r : s, (r : R) • x ∈ M') : x ∈ M' := by
17183
suffices LinearMap.range (LinearMap.toSpanSingleton R M x) ≤ M' by

0 commit comments

Comments
 (0)