import Mathlib import PrimeNumberTheoremAnd.SiegelZeros.HadamardSupport import OAI.NumberTheory.SiegelZeros.Determinants.NormSqReal namespace OAI namespace SiegelZeros open scoped BigOperators open scoped Pointwise open scoped NumberField open scoped NumberField open scoped NumberField open scoped NumberField open scoped BigOperators open scoped BigOperators open Module open scoped BigOperators open scoped BigOperators open Module open scoped BigOperators open InnerProductSpace open _root_.Finset open scoped BigOperators NumberField namespace WeightedTorusJets open NumberField attribute [local instance] canonicalCyclotomicLevelNeZero canonicalCyclotomicExtension canonicalCyclotomicNumberField canonicalCyclotomicAbelian theorem source_character_global_greedy_determinant_full_local_bounds : ∃ C : ℝ, 0 < C ∧ Real.log 4 ≤ C ∧ ∃ CH : ℕ → ℝ, ∀ (q : ℕ) [NeZero q] (χ : DirichletCharacter ℂ q) (hreal : ∀ x : ZMod q, (χ x).im = 0) (hprim : χ.IsPrimitive) (hne : χ ≠ 1) (hfield : characterField (8 * q) (CyclotomicField (8 * q) ℚ) ℂ (DirichletCharacter.changeLevel (dvd_mul_left q 8) χ) ≠ sourceSqrtTwoField q (CyclotomicField (8 * q) ℚ)), ∃ (d : ℤ) (a b : (CyclotomicField (8 * q) ℚ)), Squarefree d ∧ d.natAbs ≤ q ∧ d.natAbs ∣ q ∧ ¬ IsSquare (d : ℚ) ∧ a ^ 2 = (d : (CyclotomicField (8 * q) ℚ)) ∧ b ^ 2 = 2 ∧ IntermediateField.adjoin ℚ {a} = characterField (8 * q) (CyclotomicField (8 * q) ℚ) ℂ (DirichletCharacter.changeLevel (dvd_mul_left q 8) χ) ∧ (NumberField.discr (IntermediateField.adjoin ℚ {a})).natAbs = q ∧ Int.IsFundamentalDiscr (NumberField.discr (IntermediateField.adjoin ℚ {a})) ∧ NumberField.discr (IntermediateField.adjoin ℚ {a}) = (if d % 4 = 1 then d else 4 * d) ∧ let B := IntermediateField.adjoin ℚ ({a, b} : Set (CyclotomicField (8 * q) ℚ)) let a' : B := ⟨a, IntermediateField.subset_adjoin ℚ _ (by simp)⟩ let b' : B := ⟨b, IntermediateField.subset_adjoin ℚ _ (by simp)⟩ ∃ v : Module.Basis (Fin 4) ℚ B, (∀ i, v i = ![1, a', b', a' * b'] i) ∧ (∀ i, IsIntegral ℤ (v i)) ∧ Module.finrank ℚ B = 4 ∧ ∃ σ τ : B ≃ₐ[ℚ] B, σ a' = -a' ∧ σ b' = b' ∧ τ a' = a' ∧ τ b' = -b' ∧ Nat.card (B ≃ₐ[ℚ] B) = 4 ∧ (∀ f : B ≃ₐ[ℚ] B, f = 1 ∨ f = σ ∨ f = τ ∨ f = σ * τ) ∧ (∀ f g : B ≃ₐ[ℚ] B, Commute f g) ∧ ∀ N H : ℕ, 0 < H → H ≤ N → ∀ n : Fin (N ^ 4) ≃ (Fin 4 → Fin N), let θ := fun j => ∑ i : Fin 4, ((n j i : ℕ) : B) * ![1, a', b', a' * b'] i let R := fun α : Fin 3 → ℕ => fun j => θ j ^ α 0 * σ (θ j) ^ α 1 * (σ * τ) (θ j) ^ α 2 let s := weightedJetIndices H (N ^ 4 - 1) let w := fun α : Fin 3 → ℕ => α 0 + H * α 1 + H * α 2 ∀ e : ℕ ≃ (Fin 3 → ℕ), Monotone (fun i => w (e i)) → ∃ (g : Fin (N ^ 4) ↪o ℕ) (α : Fin (N ^ 4) ↪ (Fin 3 → ℕ)), Set.range g = (greedyPivots B (R ∘ e) s.card : Set ℕ) ∧ (∀ i, α i = e (g i)) ∧ Set.range α = ((greedyPivots B (R ∘ e) s.card).image e : Set (Fin 3 → ℕ)) ∧ Monotone (fun i => w (α i)) ∧ (∀ i, w (α i) ≤ N ^ 4 - 1) ∧ (∀ t : ℕ, s.card ≤ t → Set.range g = (greedyPivots B (R ∘ e) t : Set ℕ)) ∧ ∃ Δ : 𝓞 B, (Δ : B) = Matrix.det (fun i j => R (α i) j) ∧ Δ ≠ 0 ∧ ((1 / 4 : ℝ) * Real.log |(Algebra.norm ℚ (Δ : B) : ℝ)| ≤ (N : ℝ) ^ 4 / 2 * Real.log ((N : ℝ) ^ 4) + ((∑ i, (α i 0 : ℝ)) + (∑ i, ((α i 1 : ℝ) + α i 2))) * (Real.log N + 1 / 2 * Real.log q + Real.log 8)) ∧ (∀ p : ℕ, p.Prime → H < p → ¬ p ∣ 2 * q → χ p = -1 → Δ ∈ (Ideal.span {(p : 𝓞 B)}) ^ (∑ i, α i 0 / p)) ∧ (∀ U : ℝ, 0 ≤ U → let P := (Nat.primesLE ⌊U⌋₊).filter (fun p => H < p ∧ ¬p ∣ 2 * q ∧ χ p = -1) let E := fun p => ∑ i, α i 0 / p let S₁ := ∑ i, (α i 0 : ℝ) (∑ p ∈ P, (E p : ℝ) * Real.log p ≤ (1 / 4 : ℝ) * Real.log |(Algebra.norm ℚ (Δ : B) : ℝ)|) ∧ (S₁ * (∑ p ∈ P, Real.log p / (p : ℝ)) - (N : ℝ) ^ 4 * (∑ p ∈ Nat.primesLE ⌊U⌋₊, Real.log p) ≤ ∑ p ∈ P, (E p : ℝ) * Real.log p) ∧ (S₁ * (∑ p ∈ P, Real.log p / (p : ℝ)) - Real.log 4 * (N : ℝ) ^ 4 * U ≤ (1 / 4 : ℝ) * Real.log |(Algebra.norm ℚ (Δ : B) : ℝ)|) ) ∧ ∀ β : ℝ, 0 < β → β < 1 → DirichletCharacter.LFunction χ (β : ℂ) = 0 → ∀ U : ℝ, 0 ≤ U → (∑ i, (α i 0 : ℝ)) * (Real.log U - C * Real.log q - C * ((1 - β) * Real.log q) * (Real.log U) ^ 2 / Real.log q - CH H) - C * (N : ℝ) ^ 4 * U ≤ (1 / 4 : ℝ) * Real.log |(Algebra.norm ℚ (Δ : B) : ℝ)| := by classical obtain ⟨C, hC, hC4, hfinite⟩ := source_given_determinant_finite_lower_of_real_zero choose CH hCH using hfinite refine ⟨C, hC, hC4, CH, ?_⟩ intro q _ χ hreal hprim hne hfield obtain ⟨d, a, b, hd, hbound, hddiv, hns, ha, hb, hchar, hdisc, hfund, hformula, v, hv, hint, hdegree, σ, τ, hσa, hσb, hτa, hτb, hcard, hall, hcomm, hsource⟩ := source_character_global_greedy_determinant_local_bounds q χ hreal hprim hne hfield refine ⟨d, a, b, hd, hbound, hddiv, hns, ha, hb, hchar, hdisc, hfund, hformula, v, hv, hint, hdegree, σ, τ, hσa, hσb, hτa, hτb, hcard, hall, hcomm, ?_⟩ intro N H hH hHN n dsimp only intro e he obtain ⟨g, α, hg, hα, hrange, hmono, hweight, hstable, Δ, hΔ, hneΔ, harch, hdiv, hraw⟩ := hsource N H hH hHN n e he refine ⟨g, α, hg, hα, hrange, hmono, hweight, hstable, Δ, hΔ, hneΔ, harch, hdiv, hraw, ?_⟩ intro β hβ0 hβ1 hzero U hU simpa only [Nat.cast_pow] using hCH H q χ hprim hne hreal β hβ0 hβ1 hzero _ hdegree (N ^ 4) Δ hneΔ α hdiv U hU end WeightedTorusJets end SiegelZeros end OAI