File size: 5,280 Bytes
4a56cd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.RingTheory.Localization.Integer
import Mathlib.RingTheory.Localization.Away.Basic
import Mathlib.RingTheory.Extension.Presentation.Core
/-! # Algebra -/
namespace OAI.ArithmeticGeometry.Models.Algebra.Constructions.Foundations
/-! Algebraic foundations for Foundations. This file imports no graph statements. -/
open scoped _root_.NumberField nonZeroDivisors TensorProduct
universe u v
variable (K : Type u) [Field K] [NumberField K]
/-- A nonzero natural denominator defines the canonical map into the number field. -/
noncomputable def integersAwayToField (N : β) (hN : N β 0) :
Localization.Away (N : π K) β+* K :=
IsLocalization.Away.lift (N : π K)
(show IsUnit (algebraMap (π K) K (N : π K)) from
by simpa using (isUnit_iff_ne_zero.mpr (Nat.cast_ne_zero.mpr hN) : IsUnit (N : K)))
@[simp]
theorem integersAwayToField_algebraMap (N : β) (hN : N β 0) (a : π K) :
integersAwayToField K N hN (algebraMap (π K) (Localization.Away (N : π K)) a) =
algebraMap (π K) K a :=
IsLocalization.Away.lift_eq _ _ _
theorem integersAwayToField_comp (N : β) (hN : N β 0) :
(integersAwayToField K N hN).comp
(algebraMap (π K) (Localization.Away (N : π K))) =
algebraMap (π K) K := by
ext a
exact integersAwayToField_algebraMap K N hN a
/-- A common natural denominator can also contain prescribed prime factors. -/
theorem exists_common_natural_denominator
{ΞΉ : Type v} [Finite ΞΉ] (x : ΞΉ β K) (Nβ : β) (hNβ : Nβ β 0) :
β N : β, N β 0 β§ Nβ β£ N β§
β i, β a : π K, algebraMap (π K) K a = (N : K) * x i := by
obtain β¨b, hbβ© := IsLocalization.exist_integer_multiples_of_finite
(Algebra.algebraMapSubmonoid (π K) β€β°) x
obtain β¨m, hm, hmbβ© := b.property
have hm0 : m β 0 := mem_nonZeroDivisors_iff_ne_zero.mp hm
let N := Nβ * m.natAbs
have hN : N β 0 := mul_ne_zero hNβ (Int.natAbs_ne_zero.mpr hm0)
refine β¨N, hN, dvd_mul_right Nβ m.natAbs, ?_β©
have hmN : m β£ (N : β€) := Int.dvd_natCast.mpr (dvd_mul_left m.natAbs Nβ)
obtain β¨c, hcβ© := hmN
intro i
obtain β¨a, haβ© := hb i
refine β¨(c : π K) * a, ?_β©
have ha' : algebraMap (π K) K a = (m : K) * x i := by
simpa [Algebra.smul_def, β hmb] using ha
have hc' : (N : K) = (m : K) * (c : K) := by
exact_mod_cast hc
simp only [map_mul, map_intCast, ha', hc']
rw [β mul_assoc, mul_comm (c : K) (m : K)]
/-- Every element with denominator `N` belongs to the canonical localization image. -/
theorem mem_range_integersAwayToField
(N : β) (hN : N β 0) (x : K)
(hx : β a : π K, algebraMap (π K) K a = (N : K) * x) :
x β (integersAwayToField K N hN).range := by
obtain β¨a, haβ© := hx
let L := Localization.Away (N : π K)
let j := integersAwayToField K N hN
let z : L := IsLocalization.Away.invSelf (N : π K)
have hz : (N : K) * j z = 1 := by
have H := congrArg j (IsLocalization.Away.mul_invSelf (S := L) (N : π K))
simpa [j] using H
refine β¨algebraMap (π K) L a * z, ?_β©
change j (algebraMap (π K) L a * z) = x
rw [map_mul, integersAwayToField_algebraMap, ha]
calc
(N : K) * x * j z = x * ((N : K) * j z) := by ac_rfl
_ = x := by rw [hz, mul_one]
/-- A finite family of coefficients is contained in one localization of the integers. -/
theorem finite_coefficients_in_localized_integers
{ΞΉ : Type v} [Finite ΞΉ] (x : ΞΉ β K) (Nβ : β) (hNβ : Nβ β 0) :
β (N : β) (hN : N β 0), Nβ β£ N β§
β i, x i β (integersAwayToField K N hN).range := by
obtain β¨N, hN, hd, hβ© := exists_common_natural_denominator K x Nβ hNβ
exact β¨N, hN, hd, fun i β¦ mem_range_integersAwayToField K N hN (x i) (h i)β©
/-- A finitely presented algebra over a number field has an integral model,
with the base-change isomorphism included in the conclusion. -/
theorem finitely_presented_algebra_has_integral_model
(A : Type v) [CommRing A] [Algebra K A] [Algebra.FinitePresentation K A]
(Nβ : β) (hNβ : Nβ β 0) :
β (N : β) (hN : N β 0), Nβ β£ N β§
let L := Localization.Away (N : π K)
letI : Algebra L K := (integersAwayToField K N hN).toAlgebra
β (Aβ : Type u) (_ : CommRing Aβ) (_ : Algebra L Aβ),
Algebra.FinitePresentation L Aβ β§ Nonempty (K β[L] Aβ ββ[K] A) := by
classical
let P := Algebra.Presentation.ofFinitePresentation K A
let : Finite P.coeffs := P.finite_coeffs.to_subtype
obtain β¨N, hN, hd, hcoeffβ© := finite_coefficients_in_localized_integers K
(fun c : P.coeffs β¦ (c : K)) Nβ hNβ
refine β¨N, hN, hd, ?_β©
let L := Localization.Away (N : π K)
let : Algebra L K := (integersAwayToField K N hN).toAlgebra
let : Algebra L A := ((algebraMap K A).comp (integersAwayToField K N hN)).toAlgebra
let : IsScalarTower L K A := IsScalarTower.of_algebraMap_eq' rfl
let : P.HasCoeffs L := β¨fun c hc β¦ hcoeff β¨c, hcβ©β©
exact β¨P.ModelOfHasCoeffs L, inferInstance, inferInstance, inferInstance,
β¨P.tensorModelOfHasCoeffsEquiv Lβ©β©
end OAI.ArithmeticGeometry.Models.Algebra.Constructions.Foundations
|