Development/AutomorphicArithmetic/DedekindLFunctions/LandauTheorems/ChTop.lean
1import Development.AutomorphicArithmetic.DedekindLFunctions.SplitInertia23open Finset45noncomputable section67namespace Deduction89open Deduction.CH Formalism Formalism.D5 Formalism.RankGapBounds.WeightedMeanData Formalism.LFunctionChainParameters.WeightedSlopeBounds Formalism.LFunctionChainParameters.characterSumData Formalism.LFunctionChainParameters.ThickSetMeanBounds Formalism.LFunctionChainParameters.LErr Formalism.LFunctionChainParameters.LChain1011lemma ch_top_main_eq {H : Type} [AddCommGroup H] [Fintype H] [DecidableEq H] {U0 : Type} [Fintype U0] {W : U0 → Type}12[∀ u0, Fintype (W u0)] [∀ u0, Nonempty (W u0)]13{Top : Type} [Fintype Top] {m f : ℕ} (Dd : Data U0 W Top m f) (tr : U0 → H) (D : ArithData H) (N : ℕ)14(ell : AddChar (E0 × H) ℂ → ℂ) (TT : Finset H) (a : H → ℝ) (w : H → Fin m → E0 × H → ℝ)15(eT : Top ≃ TT) (eP : Fin f ≃ PhiSet (H := H)) (hId : IdentU Dd tr D N ell TT a w eT eP) (u0 : U0) :16Dd.Main u0 = ∑ t ∈ TT, ∑ j : Fin m, (MAIN ell (a t) (w (tr u0) j)).re := by17obtain ⟨ha, hw, hg, hL, -⟩ := hId18have hf : (f : ℝ) = (#(PhiSet (H := H)) : ℝ) := by19have := Fintype.card_congr eP20simp only [Fintype.card_fin, Fintype.card_coe] at this21exact_mod_cast this22have hsum : ∀ g : E0 × H → ℝ, ∑ ρ : Fin f, g (eP ρ) = ∑ x ∈ PhiSet, g x := by23intro g24rw [← Finset.sum_coe_sort PhiSet]25exact Equiv.sum_comp eP (fun x => g x)26unfold Data.Main27simp only [ha, hw, hg, hL, hsum, hf]28rw [Finset.sum_comm]29rw [← Finset.sum_coe_sort TT]30rw [← Equiv.sum_comp eT]31refine Finset.sum_congr rfl fun t _ => Finset.sum_congr rfl fun j _ => ?_32simp [MAIN, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im]33left34left35exact hsum (fun x => Real.log (w (tr u0) j x))3637theorem ch_top {H : Type} [AddCommGroup H] [Fintype H] [DecidableEq H] {U0 : Type} [Fintype U0] {W : U0 → Type} [∀ u0, Fintype (W u0)] [∀ u0, Nonempty (W u0)]38{Top : Type} [Fintype Top] {m f : ℕ} (Dd : Data U0 W Top m f) (tr : U0 → H) (C : Consts) (Xpp eK K : ℝ)39(D : ArithData H) (ell : AddChar (E0 × H) ℂ → ℂ) (N : ℕ) (TT T2 : Finset H) (a : H → ℝ)40(w : H → Fin m → E0 × H → ℝ) (eT : Top ≃ TT) (eP : Fin f ≃ PhiSet (H := H))41(h1 : IdentU Dd tr D N ell TT a w eT eP) (h2 : SizeData₂ Dd C Xpp) (h3 : ErrWindows Dd C Xpp eK K) (h4 : BNBoundsU Dd T2)42(h5 : LargeX Dd.x Dd.ε K C.cHH eK) (u : U0) :43gapA D N ell TT a w (tr u) ≤44Dd.x ^ (CErr C * Dd.ε) * errorBracketSizeWindows Dd.x Dd.ε (Fintype.card H) TT.card T2.card m Dd.b Dd.k Dd.a := by45have hmain := ch_top_main_eq Dd tr D N ell TT a w eT eP h1 u46have hask := h1.2.2.2.2 u47have hgap : gapA D N ell TT a w (tr u) = Dd.ASK u - Dd.Main u := by48rw [hask, hmain]49unfold gapA50rw [← Finset.sum_sub_distrib]