|
| 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 |
0 commit comments