roseking's picture
Add lean source and binary files (part 84)
cdec422 verified
Raw History Blame Contribute Delete
3.57 kB
import OAI.LinearAlgebra.CirculantHadamard.LocalDVR
import Mathlib.RingTheory.Localization.AtPrime.Basic
import Mathlib.RingTheory.Localization.Submodule
import Mathlib.RingTheory.Int.Basic
import Mathlib.Algebra.CharP.Algebra
import Mathlib.Algebra.Ring.Int.Parity
namespace OAI
/-!
# The integers localized at the prime two
The ring is the actual localization of `ℤ` at the complement of `(2)`. Its
maximal ideal is generated by the image of two, and its nonzero generator makes
it a discrete valuation ring. The characteristic-zero and odd-unit interfaces
refer to this concrete localization, without assuming any valuation facts.
-/
noncomputable section
namespace CirculantHadamard.IntegerTwoLocal
/-- The prime ideal `(2)` in the integers. -/
def ideal : Ideal ℤ := Ideal.span {(2 : ℤ)}
instance ideal_isPrime : ideal.IsPrime := by
apply (Ideal.span_singleton_prime (by norm_num : (2 : ℤ) ≠ 0)).mpr
exact Nat.prime_iff_prime_int.mp Nat.prime_two
/-- The actual ring `ℤ_(2)`. -/
abbrev Ring := Localization.AtPrime ideal
/-- The localization has no zero divisors. -/
theorem isDomain : IsDomain Ring := inferInstance
/-- The complement-of-prime localization is local. -/
theorem isLocalRing : IsLocalRing Ring := inferInstance
/-- Integer coefficients embed faithfully in the concrete localization. -/
theorem algebraMap_injective : Function.Injective (algebraMap ℤ Ring) :=
IsLocalization.injective Ring ideal.primeCompl_le_nonZeroDivisors
instance charZero : CharZero Ring :=
charZero_of_injective_algebraMap algebraMap_injective
/-- Noetherianity is inherited from the integer ring by localization. -/
instance isNoetherianRing : IsNoetherianRing Ring :=
IsLocalization.isNoetherianRing ideal.primeCompl Ring
(inferInstance : IsNoetherianRing ℤ)
/-- The maximal ideal is exactly the principal ideal generated by two. -/
theorem maximalIdeal_eq_span :
IsLocalRing.maximalIdeal Ring = Ideal.span {(2 : Ring)} := by
calc
IsLocalRing.maximalIdeal Ring = Ideal.map (algebraMap ℤ Ring) ideal :=
(Localization.AtPrime.map_eq_maximalIdeal (I := ideal)).symm
_ = Ideal.span {(2 : Ring)} := by
simp only [ideal, Ideal.map_span, Set.image_singleton, map_ofNat]
theorem two_ne_zero : (2 : Ring) ≠ 0 := by norm_num
theorem two_not_isUnit : ¬ IsUnit (2 : Ring) := by
rw [← mem_nonunits_iff, ← IsLocalRing.mem_maximalIdeal, maximalIdeal_eq_span]
exact Ideal.mem_span_singleton_self _
/-- The concrete localization is a discrete valuation ring with uniformizer
(two); this conclusion is obtained from its proved principal maximal ideal. -/
instance isDiscreteValuationRing : IsDiscreteValuationRing Ring :=
LocalDVR.isDiscreteValuationRing_of_maximalIdeal_eq_span two_ne_zero
maximalIdeal_eq_span
@[simp] theorem mem_ideal_iff_even (z : ℤ) : z ∈ ideal ↔ Even z := by
simp only [ideal, Ideal.mem_span_singleton, even_iff_two_dvd]
/-- Exactly the odd integers become units. -/
theorem isUnit_algebraMap_iff_odd (z : ℤ) :
IsUnit (algebraMap ℤ Ring z) ↔ Odd z := by
rw [IsLocalization.AtPrime.isUnit_to_map_iff Ring ideal z]
change z ∉ ideal ↔ Odd z
rw [mem_ideal_iff_even, Int.not_even_iff_odd]
theorem isUnit_intCast_of_odd (z : ℤ) (hz : Odd z) : IsUnit (z : Ring) := by
simpa using (isUnit_algebraMap_iff_odd z).mpr hz
theorem isUnit_natCast_of_odd (u : ℕ) (hu : Odd u) : IsUnit (u : Ring) := by
simpa only [Int.cast_natCast] using
isUnit_intCast_of_odd (u : ℤ) ((Int.odd_coe_nat u).mpr hu)
end CirculantHadamard.IntegerTwoLocal
end
end OAI