|
| 1 | +/- |
| 2 | +Copyright (c) 2025 Riccardo Brasca. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Riccardo Brasca |
| 5 | +-/ |
| 6 | + |
| 7 | +import Mathlib.Algebra.Lie.OfAssociative |
| 8 | +import Mathlib.Order.CompletePartialOrder |
| 9 | +import Mathlib.RingTheory.DedekindDomain.PID |
| 10 | +import Mathlib.FieldTheory.Separable |
| 11 | + |
| 12 | +/-! |
| 13 | +# Instances for Dedekind domains |
| 14 | +This file contains various instances to work with localization of a ring extension. |
| 15 | +
|
| 16 | +A very common situation in number theory is to have an extension of (say) Dedekind domains `R` and |
| 17 | +`S`, and to prove a property of this extension it is useful to consider the localization `Rₚ` of `R` |
| 18 | +at `P`, a prime ideal of `R`. One also works with the corresponding localization `Sₚ` of `S` and the |
| 19 | +fraction fields `K` and `L` of `R` and `S`. In this situation there are many compatible algebra |
| 20 | +structures and various properties of the rings involved. This file contains a collection of such |
| 21 | +instances. |
| 22 | +
|
| 23 | +## Implementation details |
| 24 | +In general one wants all the results below for any algebra satisfying `IsLocalization`, but those |
| 25 | +cannot be instances (since Lean has no way of guessing the submonoid). Having the instances in the |
| 26 | +special case of *the* localization at a prime ideal is useful in working with Dedekind domains. |
| 27 | +
|
| 28 | +-/ |
| 29 | + |
| 30 | +open nonZeroDivisors IsLocalization Algebra IsFractionRing IsScalarTower |
| 31 | + |
| 32 | +attribute [local instance] FractionRing.liftAlgebra |
| 33 | + |
| 34 | +variable {R : Type*} (S : Type*) [CommRing R] [CommRing S] [IsDomain R] [IsDomain S] [Algebra R S] |
| 35 | + |
| 36 | +local notation3 "K" => FractionRing R |
| 37 | +local notation3 "L" => FractionRing S |
| 38 | +section |
| 39 | + |
| 40 | +theorem algebraMapSubmonoid_le_nonZeroDivisors_of_faithfulSMul {A : Type*} (B : Type*) |
| 41 | + [CommSemiring A] [CommSemiring B] [Algebra A B] [NoZeroDivisors B] [FaithfulSMul A B] |
| 42 | + {S : Submonoid A} (hS : S ≤ A⁰) : algebraMapSubmonoid B S ≤ B⁰ := |
| 43 | + map_le_nonZeroDivisors_of_injective _ (FaithfulSMul.algebraMap_injective A B) hS |
| 44 | + |
| 45 | +variable (Rₘ Sₘ : Type*) [CommRing Rₘ] [CommRing Sₘ] [Algebra R Rₘ] [NoZeroSMulDivisors R S] |
| 46 | + [Algebra.IsSeparable (FractionRing R) (FractionRing S)] {M : Submonoid R} [IsLocalization M Rₘ] |
| 47 | + [Algebra Rₘ Sₘ] [Algebra S Sₘ] [Algebra R Sₘ] [IsScalarTower R Rₘ Sₘ] |
| 48 | + [IsScalarTower R S Sₘ] [IsLocalization (algebraMapSubmonoid S M) Sₘ] |
| 49 | + [Algebra (FractionRing Rₘ) (FractionRing Sₘ)] |
| 50 | + [IsScalarTower Rₘ (FractionRing Rₘ) (FractionRing Sₘ)] |
| 51 | + |
| 52 | +include R S in |
| 53 | +theorem FractionRing.isSeparable_of_isLocalization (hM : M ≤ R⁰) : |
| 54 | + Algebra.IsSeparable (FractionRing Rₘ) (FractionRing Sₘ) := by |
| 55 | + let M' := algebraMapSubmonoid S M |
| 56 | + have hM' : algebraMapSubmonoid S M ≤ S⁰ := algebraMapSubmonoid_le_nonZeroDivisors_of_faithfulSMul |
| 57 | + _ hM |
| 58 | + let f₁ : Rₘ →+* K := map _ (T := R⁰) (RingHom.id R) hM |
| 59 | + let f₂ : Sₘ →+* L := map _ (T := S⁰) (RingHom.id S) hM' |
| 60 | + algebraize [f₁, f₂] |
| 61 | + have := localization_isScalarTower_of_submonoid_le Rₘ K _ _ hM |
| 62 | + have := localization_isScalarTower_of_submonoid_le Sₘ L _ _ hM' |
| 63 | + have := isFractionRing_of_isDomain_of_isLocalization M Rₘ K |
| 64 | + have := isFractionRing_of_isDomain_of_isLocalization M' Sₘ L |
| 65 | + have : IsDomain Rₘ := isDomain_of_le_nonZeroDivisors _ hM |
| 66 | + apply Algebra.IsSeparable.of_equiv_equiv (FractionRing.algEquiv Rₘ K).symm.toRingEquiv |
| 67 | + (FractionRing.algEquiv Sₘ L).symm.toRingEquiv |
| 68 | + apply ringHom_ext R⁰ |
| 69 | + ext |
| 70 | + simp only [AlgEquiv.toRingEquiv_eq_coe, RingHom.coe_comp, |
| 71 | + RingHom.coe_coe, Function.comp_apply, ← algebraMap_apply] |
| 72 | + rw [algebraMap_apply R Rₘ (FractionRing R), AlgEquiv.coe_ringEquiv, AlgEquiv.commutes, |
| 73 | + algebraMap_apply R S L, algebraMap_apply S Sₘ L, AlgEquiv.coe_ringEquiv, AlgEquiv.commutes] |
| 74 | + simp only [← algebraMap_apply] |
| 75 | + rw [algebraMap_apply R Rₘ (FractionRing Rₘ), ← algebraMap_apply Rₘ, ← algebraMap_apply] |
| 76 | + |
| 77 | +end |
| 78 | + |
| 79 | +variable {P : Ideal R} [P.IsPrime] |
| 80 | + |
| 81 | +local notation3 "P'" => algebraMapSubmonoid S P.primeCompl |
| 82 | +local notation3 "Rₚ" => Localization.AtPrime P |
| 83 | +local notation3 "Sₚ" => Localization P' |
| 84 | + |
| 85 | +variable [FaithfulSMul R S] |
| 86 | + |
| 87 | +noncomputable instance : Algebra Sₚ L := |
| 88 | + (map _ (T := S⁰) (RingHom.id S) |
| 89 | + (algebraMapSubmonoid_le_nonZeroDivisors_of_faithfulSMul _ |
| 90 | + P.primeCompl_le_nonZeroDivisors)).toAlgebra |
| 91 | + |
| 92 | +instance : IsScalarTower S Sₚ L := |
| 93 | + localization_isScalarTower_of_submonoid_le _ _ _ _ |
| 94 | + (algebraMapSubmonoid_le_nonZeroDivisors_of_faithfulSMul _ |
| 95 | + P.primeCompl_le_nonZeroDivisors) |
| 96 | + |
| 97 | +instance : IsFractionRing Rₚ K := |
| 98 | + isFractionRing_of_isDomain_of_isLocalization P.primeCompl _ _ |
| 99 | + |
| 100 | +instance : IsFractionRing Sₚ L := |
| 101 | + isFractionRing_of_isDomain_of_isLocalization P' _ _ |
| 102 | + |
| 103 | +noncomputable instance : Algebra Rₚ L := |
| 104 | + (lift (M := P.primeCompl) (g := algebraMap R L) <| |
| 105 | + fun ⟨x, hx⟩ ↦ by simpa using fun h ↦ hx <| by simp [h]).toAlgebra |
| 106 | + |
| 107 | +-- Make sure there are no diamonds in the case `R = S`. |
| 108 | +example : instAlgebraLocalizationAtPrime P = instAlgebraAtPrimeFractionRing (S := R) := by |
| 109 | + with_reducible_and_instances rfl |
| 110 | + |
| 111 | +instance : IsScalarTower Rₚ K L := |
| 112 | + of_algebraMap_eq' (ringHom_ext P.primeCompl |
| 113 | + (RingHom.ext fun x ↦ by simp [RingHom.algebraMap_toAlgebra])) |
| 114 | + |
| 115 | +instance : IsScalarTower R Rₚ K := |
| 116 | + of_algebraMap_eq' (RingHom.ext fun x ↦ by simp [RingHom.algebraMap_toAlgebra]) |
| 117 | + |
| 118 | +instance : IsScalarTower Rₚ Sₚ L := by |
| 119 | + refine IsScalarTower.of_algebraMap_eq' <| IsLocalization.ringHom_ext P.primeCompl ?_ |
| 120 | + rw [RingHom.comp_assoc, ← IsScalarTower.algebraMap_eq R Rₚ Sₚ, IsScalarTower.algebraMap_eq R S Sₚ, |
| 121 | + ← RingHom.comp_assoc, ← IsScalarTower.algebraMap_eq S Sₚ L, IsScalarTower.algebraMap_eq Rₚ K L, |
| 122 | + RingHom.comp_assoc, ← IsScalarTower.algebraMap_eq, ← IsScalarTower.algebraMap_eq, |
| 123 | + ← IsScalarTower.algebraMap_eq] |
| 124 | + |
| 125 | +instance [IsDedekindDomain S] : IsDedekindDomain Sₚ := |
| 126 | + isDedekindDomain S |
| 127 | + (algebraMapSubmonoid_le_nonZeroDivisors_of_faithfulSMul _ P.primeCompl_le_nonZeroDivisors) _ |
| 128 | + |
| 129 | +instance [IsDedekindDomain R] [IsDedekindDomain S] [Module.Finite R S] [hP : NeZero P] : |
| 130 | + IsPrincipalIdealRing Sₚ := |
| 131 | + IsDedekindDomain.isPrincipalIdealRing_localization_over_prime S P (fun h ↦ hP.1 h) |
| 132 | + |
| 133 | +instance [Algebra.IsSeparable K L] : |
| 134 | + -- Without the following line there is a timeout |
| 135 | + letI : Algebra Rₚ (FractionRing Sₚ) := OreLocalization.instAlgebra |
| 136 | + Algebra.IsSeparable (FractionRing Rₚ) (FractionRing Sₚ) := |
| 137 | + let _ : Algebra Rₚ (FractionRing Sₚ) := OreLocalization.instAlgebra |
| 138 | + FractionRing.isSeparable_of_isLocalization S _ _ P.primeCompl_le_nonZeroDivisors |
0 commit comments