Skip to content

Commit 90bee82

Browse files
committed
feat: generalize Module.Finite.trans (#9380)
Add `span_eq_closure` and `closure_induction` which say that `Submodule.span R s` is generated by `R • s` as an AddSubmonoid. I feel that the existing `span_induction` should be replaced by `closure_induction` as the latter is stronger, and allow us to remove the commutativity condition in `span_smul_of_span_eq_top` in Algebra/Tower and generalize `Module.Finite.trans` to allow a non-commutative base ring. Co-authored-by: Junyan Xu <junyanxu.math@gmail.com>
1 parent 4bd6aa2 commit 90bee82

File tree

4 files changed

+58
-33
lines changed

4 files changed

+58
-33
lines changed

Mathlib/Algebra/Algebra/Tower.lean

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -305,39 +305,31 @@ theorem smul_mem_span_smul_of_mem {s : Set S} {t : Set A} {k : S} (hks : k ∈ s
305305
fun b c hc => by rw [IsScalarTower.smul_assoc]; exact smul_mem _ _ hc
306306
#align submodule.smul_mem_span_smul_of_mem Submodule.smul_mem_span_smul_of_mem
307307

308-
variable [SMulCommClass R S A]
309-
310-
theorem smul_mem_span_smul {s : Set S} (hs : span R s = ⊤) {t : Set A} {k : S} {x : A}
311-
(hx : x ∈ span R t) : k • x ∈ span R (s • t) :=
312-
span_induction hx (fun x hx => smul_mem_span_smul_of_mem (hs.symm ▸ mem_top) hx)
313-
(by rw [smul_zero]; exact zero_mem _)
314-
(fun x y ihx ihy => by rw [smul_add]; exact add_mem ihx ihy)
315-
fun c x hx => smul_comm c k x ▸ smul_mem _ _ hx
316-
#align submodule.smul_mem_span_smul Submodule.smul_mem_span_smul
317-
318-
theorem smul_mem_span_smul' {s : Set S} (hs : span R s = ⊤) {t : Set A} {k : S} {x : A}
319-
(hx : x ∈ span R (s • t)) : k • x ∈ span R (s • t) :=
320-
span_induction hx
321-
(fun x hx => by
322-
let ⟨p, _hp, q, hq, hpq⟩ := Set.mem_smul.1 hx
323-
rw [← hpq, smul_smul]
324-
exact smul_mem_span_smul_of_mem (hs.symm ▸ mem_top) hq)
325-
(by rw [smul_zero]; exact zero_mem _)
326-
(fun x y ihx ihy => by rw [smul_add]; exact add_mem ihx ihy)
327-
fun c x hx => smul_comm c k x ▸ smul_mem _ _ hx
328-
#align submodule.smul_mem_span_smul' Submodule.smul_mem_span_smul'
329-
330308
theorem span_smul_of_span_eq_top {s : Set S} (hs : span R s = ⊤) (t : Set A) :
331309
span R (s • t) = (span S t).restrictScalars R :=
332310
le_antisymm
333-
(span_le.2 fun _x hx =>
334-
let ⟨p, _q, _hps, hqt, hpqx⟩ := Set.mem_smul.1 hx
335-
hpqx ▸ (span S t).smul_mem p (subset_span hqt))
336-
fun _p hp =>
337-
span_induction hp (fun x hx => one_smul S x ▸ smul_mem_span_smul hs (subset_span hx))
338-
(zero_mem _) (fun _ _ => add_mem) fun _k _x hx => smul_mem_span_smul' hs hx
311+
(span_le.2 fun _x ⟨p, _hps, _q, hqt, hpqx⟩ ↦ hpqx ▸ (span S t).smul_mem p (subset_span hqt))
312+
fun p hp ↦ closure_induction hp (zero_mem _) (fun _ _ ↦ add_mem) fun s0 y hy ↦ by
313+
refine span_induction (hs ▸ mem_top : s0 ∈ span R s)
314+
(fun x hx ↦ subset_span ⟨x, hx, y, hy, rfl⟩) ?_ ?_ ?_
315+
· rw [zero_smul]; apply zero_mem
316+
· intro _ _; rw [add_smul]; apply add_mem
317+
· intro r s0 hy; rw [IsScalarTower.smul_assoc]; exact smul_mem _ r hy
339318
#align submodule.span_smul_of_span_eq_top Submodule.span_smul_of_span_eq_top
340319

320+
-- The following two lemmas were originally used to prove `span_smul_of_span_eq_top`
321+
-- but are now not needed.
322+
theorem smul_mem_span_smul' {s : Set S} (hs : span R s = ⊤) {t : Set A} {k : S} {x : A}
323+
(hx : x ∈ span R (s • t)) : k • x ∈ span R (s • t) := by
324+
rw [span_smul_of_span_eq_top hs] at hx ⊢; exact (span S t).smul_mem k hx
325+
#align submodule.smul_mem_span_smul' Submodule.smul_mem_span_smul'
326+
327+
theorem smul_mem_span_smul {s : Set S} (hs : span R s = ⊤) {t : Set A} {k : S} {x : A}
328+
(hx : x ∈ span R t) : k • x ∈ span R (s • t) := by
329+
rw [span_smul_of_span_eq_top hs]
330+
exact (span S t).smul_mem k (span_le_restrictScalars R S t hx)
331+
#align submodule.smul_mem_span_smul Submodule.smul_mem_span_smul
332+
341333
end Module
342334

343335
section Algebra

Mathlib/LinearAlgebra/Span.lean

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,39 @@ theorem span_induction' {p : ∀ x, x ∈ span R s → Prop}
180180
fun r x hx => Exists.elim hx fun hx' hx => ⟨smul_mem _ _ hx', H2 r _ _ hx⟩
181181
#align submodule.span_induction' Submodule.span_induction'
182182

183+
open AddSubmonoid in
184+
theorem span_eq_closure {s : Set M} : (span R s).toAddSubmonoid = closure (@univ R • s) := by
185+
refine le_antisymm
186+
(fun x hx ↦ span_induction hx (fun x hx ↦ subset_closure ⟨1, trivial, x, hx, one_smul R x⟩)
187+
(zero_mem _) (fun _ _ ↦ add_mem) fun r m hm ↦ closure_induction hm ?_ ?_ fun _ _ h h' ↦ ?_)
188+
(closure_le.2 ?_)
189+
· rintro _ ⟨r, -, m, hm, rfl⟩; exact smul_mem _ _ (subset_span hm)
190+
· rintro _ ⟨r', -, m, hm, rfl⟩; exact subset_closure ⟨r * r', trivial, m, hm, mul_smul r r' m⟩
191+
· rw [smul_zero]; apply zero_mem
192+
· rw [smul_add]; exact add_mem h h'
193+
194+
/-- A variant of `span_induction` that combines `∀ x ∈ s, p x` and `∀ r x, p x → p (r • x)`
195+
into a single condition `∀ r, ∀ x ∈ s, p (r • x)`, which can be easier to verify. -/
196+
@[elab_as_elim]
197+
theorem closure_induction {p : M → Prop} (h : x ∈ span R s) (H0 : p 0)
198+
(H1 : ∀ x y, p x → p y → p (x + y)) (H2 : ∀ r : R, ∀ x ∈ s, p (r • x)) : p x := by
199+
rw [← mem_toAddSubmonoid, span_eq_closure] at h
200+
refine AddSubmonoid.closure_induction h ?_ H0 H1
201+
rintro _ ⟨r, -, m, hm, rfl⟩
202+
exact H2 r m hm
203+
204+
/-- A dependent version of `Submodule.closure_induction`. -/
205+
theorem closure_induction' {p : ∀ x, x ∈ span R s → Prop}
206+
(H0 : p 0 (Submodule.zero_mem _))
207+
(H1 : ∀ x hx y hy, p x hx → p y hy → p (x + y) (Submodule.add_mem _ ‹_› ‹_›))
208+
(H2 : ∀ (r x) (h : x ∈ s), p (r • x) (Submodule.smul_mem _ _ <| subset_span h)) {x}
209+
(hx : x ∈ span R s) : p x hx := by
210+
refine Exists.elim ?_ fun (hx : x ∈ span R s) (hc : p x hx) ↦ hc
211+
refine closure_induction hx ⟨zero_mem _, H0⟩
212+
(fun x y hx hy ↦ Exists.elim hx fun hx' hx ↦
213+
Exists.elim hy fun hy' hy ↦ ⟨add_mem hx' hy', H1 _ _ _ _ hx hy⟩)
214+
fun r x hx ↦ ⟨smul_mem _ _ (subset_span hx), H2 r x hx⟩
215+
183216
@[simp]
184217
theorem span_span_coe_preimage : span R (((↑) : span R s → M) ⁻¹' s) = ⊤ :=
185218
eq_top_iff.2 fun x ↦ Subtype.recOn x fun x hx _ ↦ by

Mathlib/RingTheory/FiniteType.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ theorem mvPolynomial_aeval_of_surjective_of_closure [AddCommMonoid M] [CommSemir
461461
intro f
462462
induction' f using induction_on with m f g ihf ihg r f ih
463463
· have : m ∈ closure S := hS.symm ▸ mem_top _
464-
refine' closure_induction this (fun m hm => _) _ _
464+
refine' AddSubmonoid.closure_induction this (fun m hm => _) _ _
465465
· exact ⟨MvPolynomial.X ⟨m, hm⟩, MvPolynomial.aeval_X _ _⟩
466466
· exact ⟨1, AlgHom.map_one _⟩
467467
· rintro m₁ m₂ ⟨P₁, hP₁⟩ ⟨P₂, hP₂⟩
@@ -487,7 +487,7 @@ theorem freeAlgebra_lift_of_surjective_of_closure [CommSemiring R] {S : Set M}
487487
intro f
488488
induction' f using induction_on with m f g ihf ihg r f ih
489489
· have : m ∈ closure S := hS.symm ▸ mem_top _
490-
refine' closure_induction this (fun m hm => _) _ _
490+
refine' AddSubmonoid.closure_induction this (fun m hm => _) _ _
491491
· exact ⟨FreeAlgebra.ι R ⟨m, hm⟩, FreeAlgebra.lift_ι_apply _ _⟩
492492
· exact ⟨1, AlgHom.map_one _⟩
493493
· rintro m₁ m₂ ⟨P₁, hP₁⟩ ⟨P₂, hP₂⟩
@@ -640,7 +640,7 @@ theorem mvPolynomial_aeval_of_surjective_of_closure [CommMonoid M] [CommSemiring
640640
intro f
641641
induction' f using induction_on with m f g ihf ihg r f ih
642642
· have : m ∈ closure S := hS.symm ▸ mem_top _
643-
refine' closure_induction this (fun m hm => _) _ _
643+
refine' Submonoid.closure_induction this (fun m hm => _) _ _
644644
· exact ⟨MvPolynomial.X ⟨m, hm⟩, MvPolynomial.aeval_X _ _⟩
645645
· exact ⟨1, AlgHom.map_one _⟩
646646
· rintro m₁ m₂ ⟨P₁, hP₁⟩ ⟨P₂, hP₂⟩
@@ -665,7 +665,7 @@ theorem freeAlgebra_lift_of_surjective_of_closure [CommSemiring R] {S : Set M}
665665
intro f
666666
induction' f using induction_on with m f g ihf ihg r f ih
667667
· have : m ∈ closure S := hS.symm ▸ mem_top _
668-
refine' closure_induction this (fun m hm => _) _ _
668+
refine' Submonoid.closure_induction this (fun m hm => _) _ _
669669
· exact ⟨FreeAlgebra.ι R ⟨m, hm⟩, FreeAlgebra.lift_ι_apply _ _⟩
670670
· exact ⟨1, AlgHom.map_one _⟩
671671
· rintro m₁ m₂ ⟨P₁, hP₁⟩ ⟨P₂, hP₂⟩

Mathlib/RingTheory/Finiteness.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ variable {R}
676676

677677
section Algebra
678678

679-
theorem trans {R : Type*} (A M : Type*) [CommSemiring R] [Semiring A] [Algebra R A]
679+
theorem trans {R : Type*} (A M : Type*) [Semiring R] [Semiring A] [Module R A]
680680
[AddCommMonoid M] [Module R M] [Module A M] [IsScalarTower R A M] :
681681
∀ [Finite R A] [Finite A M], Finite R M
682682
| ⟨⟨s, hs⟩⟩, ⟨⟨t, ht⟩⟩ =>

0 commit comments

Comments
 (0)