FLT.Assumptions.MazurProof.EvenPrincipalIdeal source foundation
DefinitionMazurN13_FLT_Assumptions_MazurProof_EvenPrincipalIdeal_p0mazur-torsion
Definitions and supporting proofs for the order-thirteen exclusion, retained from the indicated source commands.
Definition code
/- Port source: https://github.com/xiangyazi24/FLT @ 51bbb4f191ad0d3753b87123635c100a638ae580
Module: FLT.Assumptions.MazurProof.EvenPrincipalIdeal
Original leading source comments and nonproject imports are retained below. -/
import Mathlib.Algebra.Group.Int.Even
import Mathlib.RingTheory.DedekindDomain.Factorization
import Mathlib.RingTheory.Ideal.IsPrincipal
import Mathlib.Tactic
set_option autoImplicit false
/-!
# Even height-one counts in a Dedekind PID
If every prime-ideal exponent of a nonzero principal ideal is even, halve
the ideal factorization itself. This gives a literal square ideal, rather
than merely a class-group equality. Principality of its square root then
recovers the original generator as a unit times a square.
The construction is structural: it uses the factorization Finsupp of an
ideal and never enumerates height-one primes or chooses prime elements.
-/
open scoped nonZeroDivisors
open IsDedekindDomain
open UniqueFactorizationMonoid
noncomputable section
namespace MazurProof.EvenPrincipalIdeal
/-! ## Halving a factorization -/
/-- In a unique factorization monoid with no nontrivial units, an element
whose factorization multiplicities are all even is literally a square. -/
theorem exists_sq_eq_of_all_factorization_even
{A : Type*}
[CommMonoidWithZero A]
[Nontrivial A]
[UniqueFactorizationMonoid A]
[NormalizationMonoid A]
[DecidableEq A]
[Subsingleton Aˣ]
(a : A)
(ha : a ≠ 0)
(hEven : ∀ p : A, Even (factorization a p)) :
∃ b : A, b ^ 2 = a := by
let f : A →₀ ℕ := factorization a
let g : A →₀ ℕ :=
Finsupp.mapRange (fun n : ℕ => n / 2) (by simp) f
have hfg : f = g + g := by
ext p
simp only [f, g, Finsupp.add_apply, Finsupp.mapRange_apply]
obtain ⟨k, hk⟩ := hEven p
omega
let s : Multiset A := Finsupp.toMultiset g
let b : A := s.prod
have hsPrime : ∀ p ∈ s, Prime p := by
intro p hp
have hpsupp : p ∈ g.support :=
(Finsupp.mem_toMultiset g p).mp
(by simpa [s] using hp)
have hpg : g p ≠ 0 :=
Finsupp.mem_support_iff.mp hpsupp
have hpf : f p ≠ 0 := by
intro hzero
apply hpg
simp [g, hzero]
have hpnf : p ∈ normalizedFactors a := by
rw [← Multiset.count_ne_zero]
simpa [f, factorization_eq_count] using hpf
exact prime_of_normalized_factor p hpnf
have hb0 : b ≠ 0 := by
dsimp [b]
exact s.prod_ne_zero_of_prime hsPrime
have hnf_b : normalizedFactors b = s := by
dsimp [b]
exact normalizedFactors_prod_of_prime hsPrime
have hfac_b : factorization b = g := by
change Multiset.toFinsupp (normalizedFactors b) = g
rw [hnf_b]
exact Finsupp.toMultiset_toFinsupp g
have hfac_sq :
factorization (b ^ 2) = factorization a := by
rw [factorization_pow, hfac_b]
change 2 • g = f
simpa [two_nsmul] using hfg.symm
have hassoc : Associated (b ^ 2) a :=
associated_of_factorization_eq
(b ^ 2) a (pow_ne_zero 2 hb0) ha hfac_sq
exact ⟨b, associated_iff_eq.mp hassoc⟩
/-! ## From fractional-ideal counts to the integral ideal factorization -/
variable {O L : Type*}
variable [CommRing O] [IsDedekindDomain O]
variable [Field L] [Algebra O L] [IsFractionRing O L]
/-- The height-one count of the principal fractional ideal generated by an
integral element. -/
noncomputable def principalCount
(P : HeightOneSpectrum O) (x : O) : ℤ :=
FractionalIdeal.count L P
(FractionalIdeal.spanSingleton O⁰ (algebraMap O L x))
/-- Fractional-ideal count agrees with the factorization multiplicity of the
corresponding integral principal ideal. -/
theorem principalCount_eq_factorization_span
(x : O) (hx : x ≠ 0)
(P : HeightOneSpectrum O) :
principalCount (L := L) P x =
(factorization
(Ideal.span ({x} : Set O)) P.asIdeal : ℤ) := by
classical
let I : Ideal O := Ideal.span ({x} : Set O)
have hI : I ≠ 0 := by
simpa [I, Ideal.zero_eq_bot,
Ideal.span_singleton_eq_bot] using hx
have hnat :
(Associates.mk P.asIdeal).count
(Associates.mk I).factors =
factorization I P.asIdeal := by
rw [factorization_eq_count,
Associates.factors_mk _ hI,
Associates.count_some
(Associates.irreducible_mk.mpr P.irreducible),
← Multiset.count_map_eq_count' _ _
Subtype.val_injective,
Associates.map_subtype_coe_factors',
factors_eq_normalizedFactors,
← Multiset.count_map_eq_count' _ _
(Associates.mk_injective (M := Ideal O))]
calc
principalCount (L := L) P x =
FractionalIdeal.count L P
((Ideal.span ({x} : Set O) : Ideal O) :
FractionalIdeal O⁰ L) := by
unfold principalCount
rw [FractionalIdeal.coeIdeal_span_singleton]
_ =
((Associates.mk P.asIdeal).count
(Associates.mk
(Ideal.span ({x} : Set O))).factors : ℤ) := by
simpa [I] using
FractionalIdeal.count_coe L P hI
_ =
(factorization
(Ideal.span ({x} : Set O)) P.asIdeal : ℤ) := by
simpa [I] using
congrArg (fun n : ℕ => (n : ℤ)) hnat
/-! ## Unit times square -/
variable [IsPrincipalIdealRing O]
/-- If every height-one count of a nonzero principal ideal is even, its
generator is a unit times a square in the integral ring. -/
theorem exists_unit_mul_sq_of_all_principalCounts_even
(x : O) (hx : x ≠ 0)
(hcount : ∀ P : HeightOneSpectrum O,
Even (principalCount (L := L) P x)) :
∃ ε : Oˣ, ∃ y : O,
x = (ε : O) * y ^ 2 := by
classical
let I : Ideal O := Ideal.span ({x} : Set O)
have hI : I ≠ 0 := by
simpa [I, Ideal.zero_eq_bot,
Ideal.span_singleton_eq_bot] using hx
have hfacEven :
∀ q : Ideal O, Even (factorization I q) := by
intro q
by_cases hq0 : factorization I q = 0
· simp [hq0]
· have hqmem : q ∈ normalizedFactors I := by
rw [← Multiset.count_ne_zero]
simpa [factorization_eq_count] using hq0
have hqprime : Prime q :=
prime_of_normalized_factor q hqmem
let P : HeightOneSpectrum O :=
⟨q, Ideal.isPrime_of_prime hqprime,
hqprime.ne_zero⟩
have hc := hcount P
rw [principalCount_eq_factorization_span
x hx P] at hc
have hcNat :
Even
(factorization
(Ideal.span ({x} : Set O))
P.asIdeal) :=
(Int.even_coe_nat _).mp hc
simpa [I, P] using hcNat
obtain ⟨J, hJ_sq⟩ :=
exists_sq_eq_of_all_factorization_even
I hI hfacEven
let y : O := Submodule.IsPrincipal.generator J
have hJy :
Ideal.span ({y} : Set O) = J :=
Ideal.span_singleton_generator J
have hspan :
Ideal.span ({y ^ 2} : Set O) =
Ideal.span ({x} : Set O) := by
calc
Ideal.span ({y ^ 2} : Set O) =
(Ideal.span ({y} : Set O)) ^ 2 := by
simp [pow_two,
Ideal.span_singleton_mul_span_singleton]
_ = J ^ 2 := by rw [hJy]
_ = I := hJ_sq
_ = Ideal.span ({x} : Set O) := rfl
have hassoc_yx : Associated (y ^ 2) x :=
Ideal.span_singleton_eq_span_singleton.mp hspan
rcases hassoc_yx with ⟨ε, hε⟩
refine ⟨ε, y, ?_⟩
simpa [mul_comm] using hε.symm
/-- Remove an explicit integral carrier from a principal element. If all
corrected height-one counts are even, the residual factor is a unit times a
square. The divisibility hypothesis is essential for the square root to
remain integral. -/
theorem exists_unit_mul_correction_mul_sq
(a x : O)
(ha : a ≠ 0) (hx : x ≠ 0)
(hdiv : a ∣ x)
(hparity : ∀ P : HeightOneSpectrum O,
Even
(principalCount (L := L) P x -
principalCount (L := L) P a)) :
∃ ε : Oˣ, ∃ y : O,
x = (ε : O) * a * y ^ 2 := by
obtain ⟨z, hz⟩ := hdiv
have hz0 : z ≠ 0 := by
intro hz0
apply hx
simpa [hz0] using hz
have hcount_z :
∀ P : HeightOneSpectrum O,
Even (principalCount (L := L) P z) := by
intro P
have haL : algebraMap O L a ≠ 0 := by
simpa only [map_zero] using
(IsFractionRing.injective O L).ne ha
have hzL : algebraMap O L z ≠ 0 := by
simpa only [map_zero] using
(IsFractionRing.injective O L).ne hz0
have hmul :
principalCount (L := L) P x =
principalCount (L := L) P a +
principalCount (L := L) P z := by
unfold principalCount
rw [hz, map_mul,
← FractionalIdeal.spanSingleton_mul_spanSingleton,
FractionalIdeal.count_mul L P
(FractionalIdeal.spanSingleton_ne_zero_iff.mpr
haL)
(FractionalIdeal.spanSingleton_ne_zero_iff.mpr
hzL)]
have hp := hparity P
rw [hmul] at hp
simpa only [add_sub_cancel_left] using hp
obtain ⟨ε, y, hzy⟩ :=
exists_unit_mul_sq_of_all_principalCounts_even
z hz0 hcount_z
refine ⟨ε, y, ?_⟩
rw [hz, hzy]
ring
end MazurProof.EvenPrincipalIdeal
Source