Skip to content

Commit 4c5068b

Browse files
feat(RingTheory/Flat): Add theorems relating Submodule.torsion and Module.Flat (#26783)
Co-authored-by: Kevin Buzzard <k.buzzard@imperial.ac.uk> Co-authored-by: Matthew Jasper <mjjasper1@gmail.com>
1 parent 847721a commit 4c5068b

File tree

5 files changed

+204
-0
lines changed

5 files changed

+204
-0
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5467,6 +5467,7 @@ import Mathlib.RingTheory.Flat.FaithfullyFlat.Algebra
54675467
import Mathlib.RingTheory.Flat.FaithfullyFlat.Basic
54685468
import Mathlib.RingTheory.Flat.Localization
54695469
import Mathlib.RingTheory.Flat.Stability
5470+
import Mathlib.RingTheory.Flat.TorsionFree
54705471
import Mathlib.RingTheory.FractionalIdeal.Basic
54715472
import Mathlib.RingTheory.FractionalIdeal.Extended
54725473
import Mathlib.RingTheory.FractionalIdeal.Inverse

Mathlib/Algebra/Algebra/Bilinear.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ theorem mulLeftRight_apply (a b x : A) : mulLeftRight R (a, b) x = a * x * b :=
112112
theorem mul'_apply {a b : A} : mul' R A (a ⊗ₜ b) = a * b :=
113113
rfl
114114

115+
variable {M : Type*} [AddCommMonoid M] [Module R M]
116+
117+
theorem lift_lsmul_mul_eq_lsmul_lift_lsmul {r : R} :
118+
lift (lsmul R M ∘ₗ mul R R r) = lsmul R M r ∘ₗ lift (lsmul R M) := by
119+
apply TensorProduct.ext'
120+
intro x a
121+
simp [← mul_smul, mul_comm]
122+
115123
end NonUnitalNonAssoc
116124

117125
section NonUnital

Mathlib/Algebra/Module/LocalizedModule/Basic.lean

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,3 +1354,30 @@ instance [Subsingleton M] (S : Submonoid R) : Subsingleton (LocalizedModule S M)
13541354
use 1, S.one_mem, Subsingleton.elim _ _
13551355

13561356
end LocalizedModule
1357+
1358+
namespace IsLocalizedModule
1359+
1360+
variable {R M A N : Type*} [CommRing R] [AddCommMonoid M] [Module R M]
1361+
[CommRing A] [AddCommMonoid N] [Module A N] [Algebra R A] [Module R N] [IsScalarTower R A N]
1362+
(f : M →ₗ[R] N)
1363+
1364+
theorem noZeroSMulDivisors (S : Submonoid R) [NoZeroSMulDivisors R M] [IsLocalization S A]
1365+
[IsLocalizedModule S f] : NoZeroSMulDivisors A N := by
1366+
rw [noZeroSMulDivisors_iff]
1367+
intro c x hcx
1368+
obtain ⟨a, s, rfl⟩ := IsLocalization.mk'_surjective S c
1369+
obtain ⟨⟨m, t⟩, rfl⟩ := IsLocalizedModule.mk'_surjective S f x
1370+
rw [Function.uncurry_apply_pair] at hcx ⊢
1371+
rw [mk'_smul_mk', mk'_eq_zero, IsLocalizedModule.eq_zero_iff S] at hcx
1372+
obtain ⟨u, hl⟩ := hcx
1373+
rw [← smul_assoc] at hl
1374+
obtain (hua | rfl) := NoZeroSMulDivisors.eq_zero_or_eq_zero_of_smul_eq_zero hl
1375+
· rw [IsLocalization.mk'_eq_zero_iff]
1376+
exact Or.inl ⟨u, hua⟩
1377+
· simp
1378+
1379+
instance (S : Submonoid R) [NoZeroSMulDivisors R M] :
1380+
NoZeroSMulDivisors (Localization S) (LocalizedModule S M) :=
1381+
noZeroSMulDivisors (LocalizedModule.mkLinearMap S M) S
1382+
1383+
end IsLocalizedModule
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
/-
2+
Copyright (c) 2025 Matthew Jasper. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Matthew Jasper, Kevin Buzzard
5+
-/
6+
7+
import Mathlib.Algebra.Module.Torsion
8+
import Mathlib.RingTheory.DedekindDomain.Dvr
9+
import Mathlib.RingTheory.Flat.Localization
10+
import Mathlib.RingTheory.Ideal.IsPrincipal
11+
12+
/-!
13+
# Relationships between flatness and torsionfreeness.
14+
15+
We show that flat implies torsion-free, and that they're the same
16+
concept for rings satisfying a certain property, including Dedekind
17+
domains and valuation rings.
18+
19+
## Main theorems
20+
21+
* `Module.Flat.isSMulRegular_of_nonZeroDivisors`: Scalar multiplication by a nonzerodivisor of `R`
22+
is injective on a flat `R`-module.
23+
* `Module.Flat.torsion_eq_bot`: `Torsion R M = ⊥` if `M` is a flat `R`-module.
24+
* `Module.Flat.flat_iff_torsion_eq_bot_of_valuationRing_localized_maximal`: if localizing `R` at
25+
the complement of any maximal ideal is a valuation ring then `Torsion R M = ⊥` iff `M` is a
26+
flat `R`-module.
27+
-/
28+
-- TODO: Add definition and properties of Prüfer domains.
29+
-- TODO: Use `IsTorsionFree`.
30+
31+
open Function (Injective Surjective)
32+
33+
open LinearMap (lsmul rTensor lTensor)
34+
35+
open Submodule (IsPrincipal torsion)
36+
37+
open TensorProduct
38+
39+
namespace Module.Flat
40+
41+
section Semiring
42+
43+
variable {R M : Type*} [CommSemiring R] [AddCommMonoid M] [Module R M]
44+
45+
open LinearMap in
46+
/-- Scalar multiplication `m ↦ r • m` by a regular `r` is injective on a flat module. -/
47+
lemma isSMulRegular_of_isRegular {r : R} (hr : IsRegular r) [Flat R M] :
48+
IsSMulRegular M r := by
49+
-- `r ∈ R⁰` implies that `toSpanSingleton R R r`, i.e. `(r * ⬝) : R → R` is injective
50+
-- Flatness implies that corresponding map `R ⊗[R] M →ₗ[R] R ⊗[R] M` is injective
51+
have h := Flat.rTensor_preserves_injective_linearMap (M := M)
52+
(toSpanSingleton R R r) <| hr.right
53+
-- But precomposing and postcomposing with the isomorphism `M ≃ₗ[R] (R ⊗[R] M)`
54+
-- we get a map `M →ₗ[R] M` which is just `(r • ·)`.
55+
have h2 : (fun (x : M) ↦ r • x) = ((TensorProduct.lid R M) ∘ₗ
56+
(rTensor M (toSpanSingleton R R r)) ∘ₗ
57+
(TensorProduct.lid R M).symm) := by ext; simp
58+
-- Hence `(r • ·) : M → M` is also injective
59+
rw [IsSMulRegular, h2]
60+
simp [h, LinearEquiv.injective]
61+
62+
end Semiring
63+
64+
section Ring
65+
66+
variable {R M : Type*} [CommRing R] [AddCommGroup M] [Module R M]
67+
68+
open scoped nonZeroDivisors
69+
70+
open LinearMap in
71+
72+
/-- Scalar multiplication `m ↦ r • m` by a nonzerodivisor `r` is injective on a flat module. -/
73+
lemma isSMulRegular_of_nonZeroDivisors {r : R} (hr : r ∈ R⁰) [Flat R M] : IsSMulRegular M r := by
74+
apply isSMulRegular_of_isRegular
75+
exact le_nonZeroDivisors_iff_isRegular.mp (le_refl R⁰) ⟨r, hr⟩
76+
77+
/-- Flat modules have no torsion. -/
78+
theorem torsion_eq_bot [Flat R M] : torsion R M = ⊥ := by
79+
rw [eq_bot_iff]
80+
-- indeed the definition of torsion means "annihiliated by a nonzerodivisor"
81+
rintro m ⟨⟨r, hr⟩, h⟩
82+
-- and we just showed that 0 is the only element with this property
83+
exact isSMulRegular_of_nonZeroDivisors hr (by simpa using h)
84+
85+
/-- If `R` is Bezout then an `R`-module is flat iff it has no torsion. -/
86+
@[stacks 0539 "Generalized valuation ring to Bezout domain"]
87+
theorem flat_iff_torsion_eq_bot_of_isBezout [IsBezout R] [IsDomain R] :
88+
Flat R M ↔ torsion R M = ⊥ := by
89+
-- one way is true in general
90+
refine ⟨fun _ ↦ torsion_eq_bot, ?_⟩
91+
-- now assume R is a Bezout domain and M is a torsionfree R-module
92+
intro htors
93+
-- we need to show that if I is an ideal of R then the natural map I ⊗ M → M is injective
94+
rw [iff_lift_lsmul_comp_subtype_injective]
95+
rintro I hFG
96+
-- If I = 0 this is obvious because I ⊗ M is a subsingleton (i.e. has ≤1 element)
97+
obtain (rfl | h) := eq_or_ne I ⊥
98+
· rintro x y -
99+
apply Subsingleton.elim
100+
· -- If I ≠ 0 then I ≅ R because R is Bezout and I is finitely generated
101+
have hprinc : I.IsPrincipal := IsBezout.isPrincipal_of_FG I hFG
102+
have : IsPrincipal.generator I ≠ 0 := by
103+
rwa [ne_eq, ← IsPrincipal.eq_bot_iff_generator_eq_zero]
104+
apply Function.Injective.of_comp_right _
105+
(LinearEquiv.rTensor M (Ideal.isoBaseOfIsPrincipal h)).surjective
106+
rw [← LinearEquiv.coe_toLinearMap, ← LinearMap.coe_comp, LinearEquiv.coe_rTensor, rTensor,
107+
lift_comp_map, LinearMap.compl₂_id, LinearMap.comp_assoc,
108+
Ideal.subtype_isoBaseOfIsPrincipal_eq_mul, LinearMap.lift_lsmul_mul_eq_lsmul_lift_lsmul,
109+
LinearMap.coe_comp]
110+
rw [← Submodule.noZeroSMulDivisors_iff_torsion_eq_bot] at htors
111+
refine Function.Injective.comp (LinearMap.lsmul_injective this) ?_
112+
rw [← Equiv.injective_comp (TensorProduct.lid R M).symm.toEquiv]
113+
convert Function.injective_id
114+
ext
115+
simp
116+
117+
/-- If every localization of `R` at a maximal ideal is a valuation ring then an `R`-module
118+
is flat iff it has no torsion. -/
119+
theorem flat_iff_torsion_eq_bot_of_valuationRing_localization_isMaximal [IsDomain R]
120+
(h : ∀ (P : Ideal R), [P.IsMaximal] → ValuationRing (Localization P.primeCompl)) :
121+
Flat R M ↔ torsion R M = ⊥ := by
122+
refine ⟨fun _ ↦ Flat.torsion_eq_bot, fun h ↦ ?_⟩
123+
apply flat_of_localized_maximal
124+
intro P hP
125+
rw [← Submodule.noZeroSMulDivisors_iff_torsion_eq_bot] at h
126+
rw [← flat_iff_of_isLocalization (Localization P.primeCompl) P.primeCompl,
127+
Flat.flat_iff_torsion_eq_bot_of_isBezout, ← Submodule.noZeroSMulDivisors_iff_torsion_eq_bot]
128+
infer_instance
129+
130+
/-- If `R` is a Dedekind domain then an `R`-module is flat iff it has no torsion. -/
131+
@[stacks 0AUW "(1)"]
132+
theorem _root_.IsDedekindDomain.flat_iff_torsion_eq_bot [IsDedekindDomain R] :
133+
Flat R M ↔ torsion R M = ⊥ := by
134+
apply flat_iff_torsion_eq_bot_of_valuationRing_localization_isMaximal
135+
exact fun P ↦ inferInstance
136+
137+
instance [IsDedekindDomain R] [NoZeroSMulDivisors R M] : Flat R M := by
138+
rw [IsDedekindDomain.flat_iff_torsion_eq_bot,
139+
← Submodule.noZeroSMulDivisors_iff_torsion_eq_bot]
140+
infer_instance
141+
142+
end Ring
143+
144+
end Module.Flat

Mathlib/RingTheory/Ideal/IsPrincipal.lean

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,28 @@ noncomputable def associatesNonZeroDivisorsMulEquivIsPrincipal :
153153
erw [associatesNonZeroDivisorsEquivIsPrincipal_mul]
154154
rfl
155155

156+
/-- A nonzero principal ideal in an integral domain `R` is isomorphic to `R` as a module.
157+
The isomorphism we choose here sends `1` to the generator chosen by `Ideal.generator`. -/
158+
noncomputable def isoBaseOfIsPrincipal {I : Ideal R}
159+
[hprinc : I.IsPrincipal] (hI : I ≠ ⊥) : R ≃ₗ[R] I :=
160+
letI x := IsPrincipal.generator I
161+
have hx : x ≠ 0 := by
162+
intro hx'
163+
rw [← IsPrincipal.eq_bot_iff_generator_eq_zero] at hx'
164+
exact hI hx'
165+
(LinearEquiv.toSpanNonzeroSingleton R R x hx).trans
166+
(LinearEquiv.ofEq (Submodule.span R {x}) I (IsPrincipal.span_singleton_generator I))
167+
168+
@[simp]
169+
theorem isoBaseOfIsPrincipal_apply {I : Ideal R} [hprinc : I.IsPrincipal] (hI : I ≠ ⊥) (x : R) :
170+
(Ideal.isoBaseOfIsPrincipal hI) x = x * IsPrincipal.generator I :=
171+
rfl
172+
173+
theorem subtype_isoBaseOfIsPrincipal_eq_mul {I : Ideal R}
174+
[hprinc : I.IsPrincipal] (h : I ≠ ⊥) :
175+
Submodule.subtype I ∘ₗ ↑(Ideal.isoBaseOfIsPrincipal h) =
176+
LinearMap.mul R R (IsPrincipal.generator I) := by
177+
ext
178+
simp
179+
156180
end Ideal

0 commit comments

Comments
 (0)