Add lean source and binary files (part 51)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- lean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientCoverTilt.leanAdded+602
- lean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientLaw.leanAdded+313
- lean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientReindex.leanAdded+69
- lean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientResidueWidths.leanAdded+553
- lean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientSubspace.leanAdded+584
- lean/OAI/Combinatorics/Progressions/Lattices/AffineCommonReferenceBudget.leanAdded+120
- lean/OAI/Combinatorics/Progressions/Lattices/AffineCoveredJetDensity.leanAdded+213
- lean/OAI/Combinatorics/Progressions/Lattices/AffineCoveredSiteValues.leanAdded+99
- lean/OAI/Combinatorics/Progressions/Lattices/AffineCubeCoordinates.leanAdded+46
- lean/OAI/Combinatorics/Progressions/Lattices/AffineCubeCoveredProjection.leanAdded+84
- lean/OAI/Combinatorics/Progressions/Lattices/AffineCubeMinorGoodMass.leanAdded+622
- lean/OAI/Combinatorics/Progressions/Lattices/AffineCubePlateauSite.leanAdded+103
- lean/OAI/Combinatorics/Progressions/Lattices/AffineCubePositiveComparison.leanAdded+361
- lean/OAI/Combinatorics/Progressions/Lattices/AffineCubeUniformRemoval.leanAdded+222
- lean/OAI/Combinatorics/Progressions/Lattices/AffineIntervalNormalizedBounds.leanAdded+42
- lean/OAI/Combinatorics/Progressions/Lattices/AffineKernelEndpointGeometry.leanAdded+151
- lean/OAI/Combinatorics/Progressions/Lattices/AffineKernelResidueRetained.leanAdded+324
- lean/OAI/Combinatorics/Progressions/Lattices/AffineLayeredModeReduction.leanAdded+53
- lean/OAI/Combinatorics/Progressions/Lattices/AffineLiftInsertion.leanAdded+94
- lean/OAI/Combinatorics/Progressions/Lattices/AffineLowestLayer.leanAdded+84
- lean/OAI/Combinatorics/Progressions/Lattices/AffineMaskedInitialShell.leanAdded+548
- lean/OAI/Combinatorics/Progressions/Lattices/AffineMeshRetention.leanAdded+646
- lean/OAI/Combinatorics/Progressions/Lattices/AffineMeshScalarTail.leanAdded+336
- lean/OAI/Combinatorics/Progressions/Lattices/AffineModerateGeometricApproximation.leanAdded+243
- lean/OAI/Combinatorics/Progressions/Lattices/AffineModeratePlateauModel.leanAdded+492
- lean/OAI/Combinatorics/Progressions/Lattices/AffineModeratePlateauSite.leanAdded+64
- lean/OAI/Combinatorics/Progressions/Lattices/AffineNormalizedScales.leanAdded+49
- lean/OAI/Combinatorics/Progressions/Lattices/AffineObservedTransport.leanAdded+80
- lean/OAI/Combinatorics/Progressions/Lattices/AffineOneSiteNormalizedLaw.leanAdded+521
- lean/OAI/Combinatorics/Progressions/Lattices/AffinePrecisionBudget.leanAdded+289
- lean/OAI/Combinatorics/Progressions/Lattices/AffinePrimitiveLogBudget.leanAdded+107
- lean/OAI/Combinatorics/Progressions/Lattices/AffineProfileTranslationL1.leanAdded+45
- lean/OAI/Combinatorics/Progressions/Lattices/AffineRefinedCoefficients.leanAdded+33
- lean/OAI/Combinatorics/Progressions/Lattices/AffineResidualRecovery.leanAdded+71
- lean/OAI/Combinatorics/Progressions/Lattices/AffineResidueAccuracy.leanAdded+79
- lean/OAI/Combinatorics/Progressions/Lattices/AffineResidueCoordinateEquiv.leanAdded+31
- lean/OAI/Combinatorics/Progressions/Lattices/AffineSampleAlphabet.leanAdded+635
- lean/OAI/Combinatorics/Progressions/Lattices/AffineSiteCoverTilt.leanAdded+84
- lean/OAI/Combinatorics/Progressions/Lattices/AffineSliceC2Difference.leanAdded+132
- lean/OAI/Combinatorics/Progressions/Lattices/AffineSourceAccuracy.leanAdded+59
- lean/OAI/Combinatorics/Progressions/Lattices/AffineSquareErrorAccuracy.leanAdded+42
- lean/OAI/Combinatorics/Progressions/Lattices/AffineTopCoefficient.leanAdded+97
- lean/OAI/Combinatorics/Progressions/Lattices/AffineWindowGoodKernelBound.leanAdded+316
- lean/OAI/Combinatorics/Progressions/Lattices/AlgebraicMajorIntegerRestoration.leanAdded+167
- lean/OAI/Combinatorics/Progressions/Lattices/AlgebraicMajorWeightedAffineTopPullback.leanAdded+528
- lean/OAI/Combinatorics/Progressions/Lattices/AllocatedActiveResidueComparison.leanAdded+436
- lean/OAI/Combinatorics/Progressions/Lattices/AllocatedActiveResiduePointMass.leanAdded+104
- lean/OAI/Combinatorics/Progressions/Lattices/AllocatedActualCRTRationalMarginal.leanAdded+86
- lean/OAI/Combinatorics/Progressions/Lattices/AllocatedAffineAnalyticBudget.leanAdded+325
- lean/OAI/Combinatorics/Progressions/Lattices/AllocatedAffineCanonicalBackendBudget.leanAdded+409
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602import Mathlib.MeasureTheory.Integral.Bochner.ContinuousLinearMapimport OAI.Combinatorics.Progressions.Fourier.AnchoredCoefficientFourierNormalizationimport OAI.Combinatorics.Progressions.Fourier.SiteFourierHaarMeanimport OAI.Combinatorics.Progressions.Lattices.SmoothResidueWindowMassimport OAI.Combinatorics.Progressions.Probability.DensityIntegralBoundimport OAI.Combinatorics.Progressions.Probability.ProbabilityIntegralApproximation
namespace OAI
section
namespace Erdos3
open Polynomial
theorem exists_integer_cover_threshold (A₀ : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ P : ℝ, 0 ≤ P → Real.exp ((P + A₀) ^ A₀) ≤ Real.exp ((P + A) ^ A) ∧ Real.exp P * Real.exp ((P + A₀) ^ A₀) ≤ Real.exp ((P + A) ^ A) := by obtain ⟨A, hA, hpoly⟩ := exists_natPolynomial_eval_budget (X + (X + C A₀) ^ A₀ + 1) refine ⟨A, hA, ?_⟩ intro P hP have he : P + (P + A₀) ^ A₀ + 1 ≤ (P + A) ^ A := by simpa [Polynomial.eval₂_pow] using hpoly P hP constructor · apply Real.exp_le_exp.mpr linarith · rw [← Real.exp_add] apply Real.exp_le_exp.mpr linarith
end Erdos3
end
section
namespace Erdos3.VectorPolynomial
theorem affineSampleCoefficientArray_smul {I K : Type*} [Fintype K] {m : ℕ} {J : Fin m → Type*} (U : ∀ j, Submodule ℝ (J j → ℝ)) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (hm : ∀ j d, coefficients (p j) d ∈ U j) (r : ℝ) (b : Option K → I → ℝ) : affineSampleCoefficientArray U (fun j => r • p j) (fun j => coefficients_smul_mem (U j) (p j) (hm j) r) b = r • affineSampleCoefficientArray U p hm b := by funext s apply Subtype.ext change (affineSampleCoefficientArray U (fun j => r • p j) _ b s).val = r • (affineSampleCoefficientArray U p hm b s).val rw [affineSampleCoefficientArray_val, affineSampleCoefficientArray_val] simp only [map_smul, Finsupp.smul_apply]
noncomputable def affineCoefficientCoverSample {I K : Type*} [Fintype K] {m : ℕ} {J : Fin m → Type*} (U : ∀ j, Submodule ℝ (J j → ℝ)) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (hm : ∀ j d, coefficients (p j) d ∈ U j) (q : ℕ) (b : Option K → I → ℝ) : CoefficientTorus (K := K) U := QuotientAddGroup.mk' (coefficientIntegerLattice U) ((q : ℝ)⁻¹ • affineSampleCoefficientArray U p hm b)
theorem affineCoefficientCoverSample_eq_scaled {I K : Type*} [Fintype K] {m : ℕ} {J : Fin m → Type*} (U : ∀ j, Submodule ℝ (J j → ℝ)) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (hm : ∀ j d, coefficients (p j) d ∈ U j) (q : ℕ) (b : Option K → I → ℝ) : affineCoefficientCoverSample U p hm q b = affineSampleCoefficientTorus U (fun j => (q : ℝ)⁻¹ • p j) (fun j => coefficients_smul_mem (U j) (p j) (hm j) (q : ℝ)⁻¹) b := by rw [affineSampleCoefficientTorus, affineSampleCoefficientArray_smul] rfl
theorem affineCoefficientCoverSample_projection {I K : Type*} [Fintype K] {m : ℕ} {J : Fin m → Type*} (U : ∀ j, Submodule ℝ (J j → ℝ)) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (hm : ∀ j d, coefficients (p j) d ∈ U j) (q : ℕ) (hq : 0 < q) (b : Option K → I → ℝ) : quotientIntegerCover (coefficientIntegerLattice U) q (affineCoefficientCoverSample U p hm q b) = affineSampleCoefficientTorus U p hm b := by have hq0 : (q : ℝ) ≠ 0 := by exact_mod_cast hq.ne' rw [affineCoefficientCoverSample, quotientIntegerCover_mk, smul_smul, mul_inv_cancel₀ hq0, one_smul] rfl
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomial
open MeasureTheoryopen scoped BigOperators Classical
theorem exists_affine_coefficient_haar_comparison (m : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {J : Fin m → Type*} [∀ j, Fintype (J j)] {F : Type*} [Fintype F] {P : ℝ} (_hP : 0 ≤ P) (_hn : (Fintype.card I : ℝ) ≤ P) (_hd : (Fintype.card (Option K × I) : ℝ) ≤ P) (U : ∀ j, Submodule ℝ (J j → ℝ)) [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] {C : ℝ} (_hC : 0 ≤ C) (_hCP : C ≤ Real.exp P) (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (_hbound : ∀ a j d, d.degree ≤ j.val + 1 → ∀ t, |(frequency a j d t : ℝ)| ≤ C) (c : F → ℂ) {B : ℝ} (_hB : 0 ≤ B) (_hBP : B ≤ Real.exp P) (_hcoefficients : (∑ a, ‖c a‖) ≤ B) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (_hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (_hm : ∀ j d, coefficients (p j) d ∈ U j) (stride : I → ℕ) (_hs : ∀ k, 0 < stride k) {R S ρ ε : ℝ} (_hS : 0 ≤ S) (_hSP : S ≤ Real.exp P) (_hρ : 0 < ρ) (_hε : 0 < ε) (_hρP : 1 / ρ ≤ Real.exp P) (_hεP : 1 / ε ≤ Real.exp P) (_hstride : ∀ k, (stride k : ℝ) ≤ S) (H : I → ℝ) (_hsize : ∀ k, Real.exp ((P + A) ^ A) ≤ H k) (_hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (_hR : Real.exp ((P + A) ^ A) ≤ R) (G : Finset (ColumnResiduePattern (Option K) I stride)) (_hG : G.Nonempty) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (_hwidth : ∀ z, ρ * H z.2 ≤ V z), ∃ hZ : 0 < ∑' x, selectedResidueSmoothWeight stride G V x, ‖(∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * coefficientTorusFourierSum U frequency c (affineSampleCoefficientTorus U p _hm (fun k j => (z (k, j) : ℝ)))) - (∫ x, coefficientTorusFourierSum U frequency c x ∂μ)‖ ≤ ε := by obtain ⟨A, hA, hnormalization⟩ := exists_affine_coefficient_fourier_normalization m refine ⟨A, hA, ?_⟩ intro I K _ _ _ J _ F _ P hP hn hd U _ _ μ _ _ C hC hCP frequency hbound c B hB hBP hcoefficients p hp hm stride hs R S ρ ε hS hSP hρ hε hρP hεP hstride H hsize hrank hR G hG V hV hwidth obtain ⟨hZ, hnorm⟩ := hnormalization hP hn hd U hC hCP frequency hbound c hB hBP hcoefficients p hp hm stride hs hS hSP hρ hε hρP hεP hstride H hsize hrank hR G hG V hV hwidth refine ⟨hZ, ?_⟩ rw [coefficientTorusFourierSum_integral] simpa only [coefficientTorusFourierSum, coefficientTorusCharacter_sample U _ p hp hm] using hnorm
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomial
open MeasureTheoryopen scoped BigOperators Classical
theorem exists_affine_coefficient_haar_approximation (m : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {J : Fin m → Type*} [∀ j, Fintype (J j)] {F : Type*} [Fintype F] {P : ℝ} (_hP : 0 ≤ P) (_hn : (Fintype.card I : ℝ) ≤ P) (_hd : (Fintype.card (Option K × I) : ℝ) ≤ P) (U : ∀ j, Submodule ℝ (J j → ℝ)) [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] {C : ℝ} (_hC : 0 ≤ C) (_hCP : C ≤ Real.exp P) (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (_hbound : ∀ a j d, d.degree ≤ j.val + 1 → ∀ t, |(frequency a j d t : ℝ)| ≤ C) (c : F → ℂ) {B : ℝ} (_hB : 0 ≤ B) (_hBP : B ≤ Real.exp P) (_hcoefficients : (∑ a, ‖c a‖) ≤ B) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (_hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (_hm : ∀ j d, coefficients (p j) d ∈ U j) (stride : I → ℕ) (_hs : ∀ k, 0 < stride k) {R S ρ ε : ℝ} (_hS : 0 ≤ S) (_hSP : S ≤ Real.exp P) (_hρ : 0 < ρ) (_hε : 0 < ε) (_hρP : 1 / ρ ≤ Real.exp P) (_hεP : 1 / ε ≤ Real.exp P) (_hstride : ∀ k, (stride k : ℝ) ≤ S) (H : I → ℝ) (_hsize : ∀ k, Real.exp ((P + A) ^ A) ≤ H k) (_hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (_hR : Real.exp ((P + A) ^ A) ≤ R) (G : Finset (ColumnResiduePattern (Option K) I stride)) (_hG : G.Nonempty) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (_hwidth : ∀ z, ρ * H z.2 ≤ V z) (f : CoefficientTorus (K := K) U → ℂ) (_hf : Integrable f μ) {η : ℝ} (_hη : 0 ≤ η) (_happrox : ∀ x, ‖f x - coefficientTorusFourierSum U frequency c x‖ ≤ η), ∃ hZ : 0 < ∑' x, selectedResidueSmoothWeight stride G V x, ‖(∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * f (affineSampleCoefficientTorus U p _hm (fun k j => (z (k, j) : ℝ)))) - (∫ x, f x ∂μ)‖ ≤ 2 * η + ε := by obtain ⟨A, hA, hcomparison⟩ := exists_affine_coefficient_haar_comparison m refine ⟨A, hA, ?_⟩ intro I K _ _ _ J _ F _ P hP hn hd U _ _ μ _ _ C hC hCP frequency hbound c B hB hBP hcoefficients p hp hm stride hs R S ρ ε hS hSP hρ hε hρP hεP hstride H hsize hrank hR G hG V hV hwidth f hf η hη happrox obtain ⟨hZ, hcomp⟩ := hcomparison hP hn hd U μ hC hCP frequency hbound c hB hBP hcoefficients p hp hm stride hs hS hSP hρ hε hρP hεP hstride H hsize hrank hR G hG V hV hwidth refine ⟨hZ, ?_⟩ let g := coefficientTorusFourierSum U frequency c let sample (z : Option K × I → ℤ) := affineSampleCoefficientTorus U p hm (fun k j => (z (k, j) : ℝ)) let E (a : CoefficientTorus (K := K) U → ℂ) := ∑' z, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * a (sample z) have hfirst := selectedResidueSmoothPMF_approximation stride G V hV hZ (fun _ => 1) (fun z => f (sample z)) (fun z => g (sample z)) hη (fun _ _ => by simp) (fun z _ => happrox (sample z)) simp only [one_mul] at hfirst have hlast := probability_integral_approximation μ g f (coefficientTorusFourierSum_integrable U frequency c μ) hf (fun x => by simpa only [norm_sub_rev] using happrox x) have htri := norm_sub_le_norm_sub_add_norm_sub (E f) (E g) (∫ x, f x ∂μ) have htri' := norm_sub_le_norm_sub_add_norm_sub (E g) (∫ x, g x ∂μ) (∫ x, f x ∂μ) change ‖E f - E g‖ ≤ η at hfirst change ‖E g - ∫ x, g x ∂μ‖ ≤ ε at hcomp change ‖E f - ∫ x, f x ∂μ‖ ≤ 2 * η + ε linarith
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomial
open MeasureTheoryopen scoped BigOperators Classical
theorem exists_affine_coefficient_cover_haar_approximation (m : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {J : Fin m → Type*} [∀ j, Fintype (J j)] {F : Type*} [Fintype F] {P : ℝ} (_hP : 0 ≤ P) (_hn : (Fintype.card I : ℝ) ≤ P) (_hd : (Fintype.card (Option K × I) : ℝ) ≤ P) (U : ∀ j, Submodule ℝ (J j → ℝ)) [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] {C : ℝ} (_hC : 0 ≤ C) (_hCP : C ≤ Real.exp P) (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (_hbound : ∀ a j d, d.degree ≤ j.val + 1 → ∀ t, |(frequency a j d t : ℝ)| ≤ C) (c : F → ℂ) {B : ℝ} (_hB : 0 ≤ B) (_hBP : B ≤ Real.exp P) (_hcoefficients : (∑ a, ‖c a‖) ≤ B) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (_hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (_hm : ∀ j d, coefficients (p j) d ∈ U j) (q : ℕ) (_hq : 0 < q) (_hqP : (q : ℝ) ≤ Real.exp P) (stride : I → ℕ) (_hs : ∀ k, 0 < stride k) {R S ρ ε : ℝ} (_hS : 0 ≤ S) (_hSP : S ≤ Real.exp P) (_hρ : 0 < ρ) (_hε : 0 < ε) (_hρP : 1 / ρ ≤ Real.exp P) (_hεP : 1 / ε ≤ Real.exp P) (_hstride : ∀ k, (stride k : ℝ) ≤ S) (H : I → ℝ) (_hsize : ∀ k, Real.exp ((P + A) ^ A) ≤ H k) (_hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (_hR : Real.exp ((P + A) ^ A) ≤ R) (G : Finset (ColumnResiduePattern (Option K) I stride)) (_hG : G.Nonempty) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (_hwidth : ∀ z, ρ * H z.2 ≤ V z) (f : CoefficientTorus (K := K) U → ℂ) (_hf : Integrable f μ) {η : ℝ} (_hη : 0 ≤ η) (_happrox : ∀ x, ‖f x - coefficientTorusFourierSum U frequency c x‖ ≤ η), ∃ hZ : 0 < ∑' x, selectedResidueSmoothWeight stride G V x, ‖(∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * f (affineCoefficientCoverSample U p _hm q (fun k j => (z (k, j) : ℝ)))) - (∫ x, f x ∂μ)‖ ≤ 2 * η + ε := by obtain ⟨A₀, _, hcomparison⟩ := exists_affine_coefficient_haar_approximation m obtain ⟨A, hA, hbudget⟩ := exists_integer_cover_threshold A₀ refine ⟨A, hA, ?_⟩ intro I K _ _ _ J _ F _ P hP hn hd U _ _ μ _ _ C hC hCP frequency hbound c B hB hBP hcoefficients p hp hm q hq hqP stride hs R S ρ ε hS hSP hρ hε hρP hεP hstride H hsize hrank hR G hG V hV hwidth f hf η hη happrox have hb := hbudget P hP have hR0 : 0 ≤ R := (Real.exp_pos _).le.trans hR have hq0 : (0 : ℝ) < q := by exact_mod_cast hq have hscaledR : Real.exp ((P + A₀) ^ A₀) ≤ R / q := by apply (le_div_iff₀ hq0).mpr calc _ ≤ Real.exp P * Real.exp ((P + A₀) ^ A₀) := by simpa only [mul_comm] using mul_le_mul_of_nonneg_right hqP (Real.exp_pos ((P + A₀) ^ A₀)).le _ ≤ Real.exp ((P + A) ^ A) := hb.2 _ ≤ R := hR obtain ⟨hZ, he⟩ := hcomparison hP hn hd U μ hC hCP frequency hbound c hB hBP hcoefficients (fun j => (q : ℝ)⁻¹ • p j) (fun j => (hp j).smul (q : ℝ)⁻¹) (fun j => coefficients_smul_mem (U j) (p j) (hm j) (q : ℝ)⁻¹) stride hs hS hSP hρ hε hρP hεP hstride H (fun k => hb.1.trans (hsize k)) (fun j => (hrank j).div_nat hR0 q hq) hscaledR G hG V hV hwidth f hf hη happrox refine ⟨hZ, ?_⟩ simpa only [affineCoefficientCoverSample_eq_scaled] using he
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomial
open MeasureTheoryopen scoped BigOperators Classical
theorem exists_affine_coefficient_density_mass (m : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {J : Fin m → Type*} [∀ j, Fintype (J j)] {F : Type*} [Fintype F] {P : ℝ} (_hP : 0 ≤ P) (_hn : (Fintype.card I : ℝ) ≤ P) (_hd : (Fintype.card (Option K × I) : ℝ) ≤ P) (U : ∀ j, Submodule ℝ (J j → ℝ)) [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] {C : ℝ} (_hC : 0 ≤ C) (_hCP : C ≤ Real.exp P) (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (_hbound : ∀ a j d, d.degree ≤ j.val + 1 → ∀ t, |(frequency a j d t : ℝ)| ≤ C) (c : F → ℂ) {B : ℝ} (_hB : 0 ≤ B) (_hBP : B ≤ Real.exp P) (_hcoefficients : (∑ a, ‖c a‖) ≤ B) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (_hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (_hm : ∀ j d, coefficients (p j) d ∈ U j) (stride : I → ℕ) (_hs : ∀ k, 0 < stride k) {R S ρ ε : ℝ} (_hS : 0 ≤ S) (_hSP : S ≤ Real.exp P) (_hρ : 0 < ρ) (_hε : 0 < ε) (_hρP : 1 / ρ ≤ Real.exp P) (_hεP : 1 / ε ≤ Real.exp P) (_hstride : ∀ k, (stride k : ℝ) ≤ S) (H : I → ℝ) (_hsize : ∀ k, Real.exp ((P + A) ^ A) ≤ H k) (_hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (_hR : Real.exp ((P + A) ^ A) ≤ R) (G : Finset (ColumnResiduePattern (Option K) I stride)) (_hG : G.Nonempty) (V : Option K × I → ℝ) (_hV : ∀ z, 0 < V z) (_hwidth : ∀ z, ρ * H z.2 ≤ V z) (D : CoefficientTorus (K := K) U → ℝ) (_hD : Integrable D μ) (_hDmass : (∫ x, D x ∂μ) = 1) {η : ℝ} (_hη : 0 ≤ η) (_happrox : ∀ x, ‖(D x : ℂ) - coefficientTorusFourierSum U frequency c x‖ ≤ η), ∃ _hZ : 0 < ∑' x, selectedResidueSmoothWeight stride G V x, |selectedResidueDensityMass stride G V (fun z => D (affineSampleCoefficientTorus U p _hm (fun k j => (z (k, j) : ℝ)))) - 1| ≤ 2 * η + ε := by obtain ⟨A, hA, hcomparison⟩ := exists_affine_coefficient_haar_approximation m refine ⟨A, hA, ?_⟩ intro I K _ _ _ J _ F _ P hP hn hd U _ _ μ _ _ C hC hCP frequency hbound c B hB hBP hcoefficients p hp hm stride hs R S ρ ε hS hSP hρ hε hρP hεP hstride H hsize hrank hR G hG V hV hwidth D hD hDmass η hη happrox obtain ⟨hZ, he⟩ := hcomparison hP hn hd U μ hC hCP frequency hbound c hB hBP hcoefficients p hp hm stride hs hS hSP hρ hε hρP hεP hstride H hsize hrank hR G hG V hV hwidth (fun x => (D x : ℂ)) hD.ofReal hη happrox refine ⟨hZ, ?_⟩ rw [integral_complex_ofReal, hDmass, Complex.ofReal_one] at he rw [← selectedResidueDensityMass_complex stride G V hV hZ (fun z => D (affineSampleCoefficientTorus U p hm (fun k j => (z (k, j) : ℝ)))), ← Complex.ofReal_one, ← Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs] at he exact he
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomial
open MeasureTheoryopen scoped BigOperators Classical
theorem exists_affine_coefficient_cover_tilted_family_comparison (m : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {J : Fin m → Type*} [∀ j, Fintype (J j)] (F : Bool → Type*) [∀ b, Fintype (F b)] {P : ℝ} (_hP : 0 ≤ P) (_hn : (Fintype.card I : ℝ) ≤ P) (_hd : (Fintype.card (Option K × I) : ℝ) ≤ P) (U : ∀ j, Submodule ℝ (J j → ℝ)) [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] {C : ℝ} (_hC : 0 ≤ C) (_hCP : C ≤ Real.exp P) (frequency : ∀ b, F b → ∀ j, (K →₀ ℕ) → J j → ℤ) (_hbound : ∀ b a j d, d.degree ≤ j.val + 1 → ∀ t, |(frequency b a j d t : ℝ)| ≤ C) (c : ∀ b, F b → ℂ) {B : ℝ} (_hB : 0 ≤ B) (_hBP : B ≤ Real.exp P) (_hcoefficients : ∀ b, (∑ a, ‖c b a‖) ≤ B) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (_hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (_hm : ∀ j d, coefficients (p j) d ∈ U j) (cover : ℕ) (_hcover : 0 < cover) (_hcoverP : (cover : ℝ) ≤ Real.exp P) (stride : I → ℕ) (_hs : ∀ k, 0 < stride k) {R S ρ ε : ℝ} (_hS : 0 ≤ S) (_hSP : S ≤ Real.exp P) (_hρ : 0 < ρ) (_hε : 0 < ε) (_hρP : 1 / ρ ≤ Real.exp P) (_hεP : 1 / ε ≤ Real.exp P) (_hstride : ∀ k, (stride k : ℝ) ≤ S) (H : I → ℝ) (_hsize : ∀ k, Real.exp ((P + A) ^ A) ≤ H k) (_hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (_hR : Real.exp ((P + A) ^ A) ≤ R) (G : Finset (ColumnResiduePattern (Option K) I stride)) (_hG : G.Nonempty) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (_hwidth : ∀ z, ρ * H z.2 ≤ V z) (D : CoefficientTorus (K := K) U → ℝ) (_hD : Integrable D μ) (_hDmass : (∫ x, D x ∂μ) = 1) (_hD0 : ∀ x, 0 ≤ D x) (f : CoefficientTorus (K := K) U → ℂ) (_hf : AEStronglyMeasurable f μ) (_hfbound : ∀ x, ‖f x‖ ≤ 1) {η : ℝ} (_hη : 0 ≤ η) (_happrox : ∀ b x, ‖(D x : ℂ) * (if b then f x else 1) - coefficientTorusFourierSum U (frequency b) (c b) x‖ ≤ η) (_hsmall : 2 * η + ε ≤ 1 / 2), ∃ hZ : 0 < ∑' x, selectedResidueSmoothWeight stride G V x, ∃ hDpos : 0 < selectedResidueDensityMass stride G V (fun z => D (affineCoefficientCoverSample U p _hm cover (fun k j => (z (k, j) : ℝ)))), |selectedResidueDensityMass stride G V (fun z => D (affineCoefficientCoverSample U p _hm cover (fun k j => (z (k, j) : ℝ)))) - 1| ≤ 2 * η + ε ∧ (1 / 2 ≤ selectedResidueDensityMass stride G V (fun z => D (affineCoefficientCoverSample U p _hm cover (fun k j => (z (k, j) : ℝ))))) ∧ (selectedResidueDensityMass stride G V (fun z => D (affineCoefficientCoverSample U p _hm cover (fun k j => (z (k, j) : ℝ)))) ≤ 3 / 2) ∧ ‖(∑' z, ((selectedResidueDensityPMF stride G V hV hZ (fun z => D (affineCoefficientCoverSample U p _hm cover (fun k j => (z (k, j) : ℝ)))) (fun _z => _hD0 _) hDpos z).toReal : ℂ) * f (affineCoefficientCoverSample U p _hm cover (fun k j => (z (k, j) : ℝ)))) - (∫ x, (D x : ℂ) * f x ∂μ)‖ ≤ 4 * (2 * η + ε) := by obtain ⟨A, hA, hcomparison⟩ := exists_affine_coefficient_cover_haar_approximation m refine ⟨A, hA, ?_⟩ intro I K _ _ _ J _ F _ P hP hn hd U _ _ μ _ _ C hC hCP frequency hbound c B hB hBP hcoefficients p hp hm cover hcover hcoverP stride hs R S ρ ε hS hSP hρ hε hρP hεP hstride H hsize hrank hR G hG V hV hwidth D hD hDmass hD0 f hf hfbound η hη happrox hsmall let sample (z : Option K × I → ℤ) := affineCoefficientCoverSample U p hm cover (fun k j => (z (k, j) : ℝ)) obtain ⟨hZ, he0⟩ := hcomparison hP hn hd U μ hC hCP (frequency false) (hbound false) (c false) hB hBP (hcoefficients false) p hp hm cover hcover hcoverP stride hs hS hSP hρ hε hρP hεP hstride H hsize hrank hR G hG V hV hwidth (fun x => (D x : ℂ)) hD.ofReal hη (fun x => by simpa using happrox false x) have hmass : |selectedResidueDensityMass stride G V (fun z => D (sample z)) - 1| ≤ 2 * η + ε := by rw [integral_complex_ofReal, hDmass, Complex.ofReal_one] at he0 rw [← selectedResidueDensityMass_complex stride G V hV hZ (fun z => D (sample z)), ← Complex.ofReal_one, ← Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs] at he0 exact he0 have hlower : 1 / 2 ≤ selectedResidueDensityMass stride G V (fun z => D (sample z)) := by have := (abs_le.mp hmass).1 linarith have hupper : selectedResidueDensityMass stride G V (fun z => D (sample z)) ≤ 3 / 2 := by have := (abs_le.mp hmass).2 linarith have hDpos : 0 < selectedResidueDensityMass stride G V (fun z => D (sample z)) := by linarith refine ⟨hZ, hDpos, hmass, hlower, hupper, ?_⟩ obtain ⟨hZ', he1⟩ := hcomparison hP hn hd U μ hC hCP (frequency true) (hbound true) (c true) hB hBP (hcoefficients true) p hp hm cover hcover hcoverP stride hs hS hSP hρ hε hρP hεP hstride H hsize hrank hR G hG V hV hwidth (fun x => (D x : ℂ) * f x) (density_mul_integrable μ D hD f hf hfbound) hη (fun x => by simpa using happrox true x) have he := selectedResidueDensityPMF_error stride G V hV hZ (fun z => D (sample z)) (fun z => hD0 _) hDpos (fun z => f (sample z)) hlower he1 hmass (norm_density_integral_le_one μ D hD hD0 hDmass f hfbound) convert he using 1; ring
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomial
open MeasureTheoryopen scoped BigOperators Classical
theorem exists_affine_coefficient_tilted_comparison (m : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {J : Fin m → Type*} [∀ j, Fintype (J j)] {F : Type*} [Fintype F] {P : ℝ} (_hP : 0 ≤ P) (_hn : (Fintype.card I : ℝ) ≤ P) (_hd : (Fintype.card (Option K × I) : ℝ) ≤ P) (U : ∀ j, Submodule ℝ (J j → ℝ)) [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] {C : ℝ} (_hC : 0 ≤ C) (_hCP : C ≤ Real.exp P) (frequency : Bool → F → ∀ j, (K →₀ ℕ) → J j → ℤ) (_hbound : ∀ b a j d, d.degree ≤ j.val + 1 → ∀ t, |(frequency b a j d t : ℝ)| ≤ C) (c : Bool → F → ℂ) {B : ℝ} (_hB : 0 ≤ B) (_hBP : B ≤ Real.exp P) (_hcoefficients : ∀ b, (∑ a, ‖c b a‖) ≤ B) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (_hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (_hm : ∀ j d, coefficients (p j) d ∈ U j) (stride : I → ℕ) (_hs : ∀ k, 0 < stride k) {R S ρ ε : ℝ} (_hS : 0 ≤ S) (_hSP : S ≤ Real.exp P) (_hρ : 0 < ρ) (_hε : 0 < ε) (_hρP : 1 / ρ ≤ Real.exp P) (_hεP : 1 / ε ≤ Real.exp P) (_hstride : ∀ k, (stride k : ℝ) ≤ S) (H : I → ℝ) (_hsize : ∀ k, Real.exp ((P + A) ^ A) ≤ H k) (_hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (_hR : Real.exp ((P + A) ^ A) ≤ R) (G : Finset (ColumnResiduePattern (Option K) I stride)) (_hG : G.Nonempty) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (_hwidth : ∀ z, ρ * H z.2 ≤ V z) (D : CoefficientTorus (K := K) U → ℝ) (_hD : Integrable D μ) (_hDmass : (∫ x, D x ∂μ) = 1) (_hD0 : ∀ x, 0 ≤ D x) (f : CoefficientTorus (K := K) U → ℂ) (_hf : AEStronglyMeasurable f μ) (_hfbound : ∀ x, ‖f x‖ ≤ 1) {η : ℝ} (_hη : 0 ≤ η) (_happrox : ∀ b x, ‖(D x : ℂ) * (if b then f x else 1) - coefficientTorusFourierSum U (frequency b) (c b) x‖ ≤ η) (_hsmall : 2 * η + ε ≤ 1 / 2), ∃ hZ : 0 < ∑' x, selectedResidueSmoothWeight stride G V x, ∃ hDpos : 0 < selectedResidueDensityMass stride G V (fun z => D (affineSampleCoefficientTorus U p _hm (fun k j => (z (k, j) : ℝ)))), |selectedResidueDensityMass stride G V (fun z => D (affineSampleCoefficientTorus U p _hm (fun k j => (z (k, j) : ℝ)))) - 1| ≤ 2 * η + ε ∧ (1 / 2 ≤ selectedResidueDensityMass stride G V (fun z => D (affineSampleCoefficientTorus U p _hm (fun k j => (z (k, j) : ℝ))))) ∧ (selectedResidueDensityMass stride G V (fun z => D (affineSampleCoefficientTorus U p _hm (fun k j => (z (k, j) : ℝ)))) ≤ 3 / 2) ∧ ‖(∑' z, ((selectedResidueDensityPMF stride G V hV hZ (fun z => D (affineSampleCoefficientTorus U p _hm (fun k j => (z (k, j) : ℝ)))) (fun _z => _hD0 _) hDpos z).toReal : ℂ) * f (affineSampleCoefficientTorus U p _hm (fun k j => (z (k, j) : ℝ)))) - (∫ x, (D x : ℂ) * f x ∂μ)‖ ≤ 4 * (2 * η + ε) := by obtain ⟨A, hA, hcomparison⟩ := exists_affine_coefficient_haar_approximation m refine ⟨A, hA, ?_⟩ intro I K _ _ _ J _ F _ P hP hn hd U _ _ μ _ _ C hC hCP frequency hbound c B hB hBP hcoefficients p hp hm stride hs R S ρ ε hS hSP hρ hε hρP hεP hstride H hsize hrank hR G hG V hV hwidth D hD hDmass hD0 f hf hfbound η hη happrox hsmall let sample (z : Option K × I → ℤ) := affineSampleCoefficientTorus U p hm (fun k j => (z (k, j) : ℝ)) obtain ⟨hZ, he0⟩ := hcomparison hP hn hd U μ hC hCP (frequency false) (hbound false) (c false) hB hBP (hcoefficients false) p hp hm stride hs hS hSP hρ hε hρP hεP hstride H hsize hrank hR G hG V hV hwidth (fun x => (D x : ℂ)) hD.ofReal hη (fun x => by simpa using happrox false x) have hmass : |selectedResidueDensityMass stride G V (fun z => D (sample z)) - 1| ≤ 2 * η + ε := by rw [integral_complex_ofReal, hDmass, Complex.ofReal_one] at he0 rw [← selectedResidueDensityMass_complex stride G V hV hZ (fun z => D (sample z)), ← Complex.ofReal_one, ← Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs] at he0 exact he0 have hlower : 1 / 2 ≤ selectedResidueDensityMass stride G V (fun z => D (sample z)) := by have := (abs_le.mp hmass).1 linarith have hupper : selectedResidueDensityMass stride G V (fun z => D (sample z)) ≤ 3 / 2 := by have := (abs_le.mp hmass).2 linarith have hDpos : 0 < selectedResidueDensityMass stride G V (fun z => D (sample z)) := by linarith refine ⟨hZ, hDpos, hmass, hlower, hupper, ?_⟩ obtain ⟨hZ', he1⟩ := hcomparison hP hn hd U μ hC hCP (frequency true) (hbound true) (c true) hB hBP (hcoefficients true) p hp hm stride hs hS hSP hρ hε hρP hεP hstride H hsize hrank hR G hG V hV hwidth (fun x => (D x : ℂ) * f x) (density_mul_integrable μ D hD f hf hfbound) hη (fun x => by simpa using happrox true x) have he := selectedResidueDensityPMF_error stride G V hV hZ (fun z => D (sample z)) (fun z => hD0 _) hDpos (fun z => f (sample z)) hlower he1 hmass (norm_density_integral_le_one μ D hD hD0 hDmass f hfbound) convert he using 1; ring
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomial
open MeasureTheoryopen scoped BigOperators Classical
theorem exists_affine_coefficient_cover_tilted_comparison (m : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {J : Fin m → Type*} [∀ j, Fintype (J j)] {F : Type*} [Fintype F] {P : ℝ} (_hP : 0 ≤ P) (_hn : (Fintype.card I : ℝ) ≤ P) (_hd : (Fintype.card (Option K × I) : ℝ) ≤ P) (U : ∀ j, Submodule ℝ (J j → ℝ)) [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] {C : ℝ} (_hC : 0 ≤ C) (_hCP : C ≤ Real.exp P) (frequency : Bool → F → ∀ j, (K →₀ ℕ) → J j → ℤ) (_hbound : ∀ b a j d, d.degree ≤ j.val + 1 → ∀ t, |(frequency b a j d t : ℝ)| ≤ C) (c : Bool → F → ℂ) {B : ℝ} (_hB : 0 ≤ B) (_hBP : B ≤ Real.exp P) (_hcoefficients : ∀ b, (∑ a, ‖c b a‖) ≤ B) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (_hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (_hm : ∀ j d, coefficients (p j) d ∈ U j) (q : ℕ) (_hq : 0 < q) (_hqP : (q : ℝ) ≤ Real.exp P) (stride : I → ℕ) (_hs : ∀ k, 0 < stride k) {R S ρ ε : ℝ} (_hS : 0 ≤ S) (_hSP : S ≤ Real.exp P) (_hρ : 0 < ρ) (_hε : 0 < ε) (_hρP : 1 / ρ ≤ Real.exp P) (_hεP : 1 / ε ≤ Real.exp P) (_hstride : ∀ k, (stride k : ℝ) ≤ S) (H : I → ℝ) (_hsize : ∀ k, Real.exp ((P + A) ^ A) ≤ H k) (_hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (_hR : Real.exp ((P + A) ^ A) ≤ R) (G : Finset (ColumnResiduePattern (Option K) I stride)) (_hG : G.Nonempty) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (_hwidth : ∀ z, ρ * H z.2 ≤ V z) (D : CoefficientTorus (K := K) U → ℝ) (_hD : Integrable D μ) (_hDmass : (∫ x, D x ∂μ) = 1) (_hD0 : ∀ x, 0 ≤ D x) (f : CoefficientTorus (K := K) U → ℂ) (_hf : AEStronglyMeasurable f μ) (_hfbound : ∀ x, ‖f x‖ ≤ 1) {η : ℝ} (_hη : 0 ≤ η) (_happrox : ∀ b x, ‖(D x : ℂ) * (if b then f x else 1) - coefficientTorusFourierSum U (frequency b) (c b) x‖ ≤ η) (_hsmall : 2 * η + ε ≤ 1 / 2), ∃ hZ : 0 < ∑' x, selectedResidueSmoothWeight stride G V x, ∃ hDpos : 0 < selectedResidueDensityMass stride G V (fun z => D (affineCoefficientCoverSample U p _hm q (fun k j => (z (k, j) : ℝ)))), |selectedResidueDensityMass stride G V (fun z => D (affineCoefficientCoverSample U p _hm q (fun k j => (z (k, j) : ℝ)))) - 1| ≤ 2 * η + ε ∧ (1 / 2 ≤ selectedResidueDensityMass stride G V (fun z => D (affineCoefficientCoverSample U p _hm q (fun k j => (z (k, j) : ℝ))))) ∧ (selectedResidueDensityMass stride G V (fun z => D (affineCoefficientCoverSample U p _hm q (fun k j => (z (k, j) : ℝ)))) ≤ 3 / 2) ∧ ‖(∑' z, ((selectedResidueDensityPMF stride G V hV hZ (fun z => D (affineCoefficientCoverSample U p _hm q (fun k j => (z (k, j) : ℝ)))) (fun _z => _hD0 _) hDpos z).toReal : ℂ) * f (affineCoefficientCoverSample U p _hm q (fun k j => (z (k, j) : ℝ)))) - (∫ x, (D x : ℂ) * f x ∂μ)‖ ≤ 4 * (2 * η + ε) := by obtain ⟨A₀, _, hcomparison⟩ := exists_affine_coefficient_tilted_comparison m obtain ⟨A, hA, hbudget⟩ := exists_integer_cover_threshold A₀ refine ⟨A, hA, ?_⟩ intro I K _ _ _ J _ F _ P hP hn hd U _ _ μ _ _ C hC hCP frequency hbound c B hB hBP hcoefficients p hp hm q hq hqP stride hs R S ρ ε hS hSP hρ hε hρP hεP hstride H hsize hrank hR G hG V hV hwidth D hD hDmass hD0 f hf hfbound η hη happrox hsmall have hb := hbudget P hP have hR0 : 0 ≤ R := (Real.exp_pos _).le.trans hR have hq0 : (0 : ℝ) < q := by exact_mod_cast hq have hscaledR : Real.exp ((P + A₀) ^ A₀) ≤ R / q := by apply (le_div_iff₀ hq0).mpr calc _ ≤ Real.exp P * Real.exp ((P + A₀) ^ A₀) := by simpa only [mul_comm] using mul_le_mul_of_nonneg_right hqP (Real.exp_pos ((P + A₀) ^ A₀)).le _ ≤ Real.exp ((P + A) ^ A) := hb.2 _ ≤ R := hR have he := hcomparison hP hn hd U μ hC hCP frequency hbound c hB hBP hcoefficients (fun j => (q : ℝ)⁻¹ • p j) (fun j => (hp j).smul (q : ℝ)⁻¹) (fun j => coefficients_smul_mem (U j) (p j) (hm j) (q : ℝ)⁻¹) stride hs hS hSP hρ hε hρP hεP hstride H (fun k => hb.1.trans (hsize k)) (fun j => (hrank j).div_nat hR0 q hq) hscaledR G hG V hV hwidth D hD hDmass hD0 f hf hfbound hη happrox hsmall simpa only [affineCoefficientCoverSample_eq_scaled] using he
end Erdos3.VectorPolynomial
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313import Mathlib.MeasureTheory.Group.Integralimport Mathlib.MeasureTheory.Measure.Haar.NormedSpaceimport OAI.Combinatorics.Progressions.Probability.SelectedDensityNormalization
namespace OAI
section
namespace Erdos3
open MeasureTheoryopen scoped ContDiff
noncomputable def affineProbabilityProfile (c w x : ℝ) : ℝ := w⁻¹ * smoothProbabilityProfile ((x - c) / w)
theorem affineProbabilityProfile_nonneg (c : ℝ) {w : ℝ} (hw : 0 < w) (x : ℝ) : 0 ≤ affineProbabilityProfile c w x := mul_nonneg (inv_nonneg.mpr hw.le) (smoothProbabilityProfile_range _).1
theorem affineProbabilityProfile_le (c : ℝ) {w : ℝ} (hw : 0 < w) (x : ℝ) : affineProbabilityProfile c w x ≤ w⁻¹ := by exact (mul_le_mul_of_nonneg_left (smoothProbabilityProfile_range _).2 (inv_nonneg.mpr hw.le)).trans_eq (mul_one _)
theorem affineProbabilityProfile_contDiff (c w : ℝ) : ContDiff ℝ ∞ (affineProbabilityProfile c w) := by change ContDiff ℝ ∞ (fun x => w⁻¹ * smoothProbabilityProfile ((x-c)/w)) exact contDiff_const.mul (smoothProbabilityProfile_contDiff.comp ((contDiff_id.sub contDiff_const).div_const w))
theorem affineProbabilityProfile_zero (c : ℝ) {w : ℝ} (hw : 0 < w) (x : ℝ) (hx : w < |x - c|) : affineProbabilityProfile c w x = 0 := by have hnorm : 1 < |(x-c)/w| := by rw [abs_div, abs_of_pos hw] exact (one_lt_div hw).mpr hx rw [affineProbabilityProfile, smoothProbabilityProfile_zero_outside _ hnorm, mul_zero]
theorem affineProbabilityProfile_zero_outside (c : ℝ) {w : ℝ} (hw : 0 < w) (x : ℝ) (hx : |c| + w < |x|) : affineProbabilityProfile c w x = 0 := by apply affineProbabilityProfile_zero c hw x have ht : |x| ≤ |x-c| + |c| := by simpa only [sub_add_cancel] using abs_add_le (x-c) c linarith
theorem affineProbabilityProfile_compact (c : ℝ) {w : ℝ} (hw : 0 < w) : HasCompactSupport (affineProbabilityProfile c w) := by apply HasCompactSupport.of_support_subset_isCompact (isCompact_closedBall (0 : ℝ) (|c|+w)) intro x hx rw [Metric.mem_closedBall, dist_zero_right, Real.norm_eq_abs] exact le_of_not_gt (fun h => hx (affineProbabilityProfile_zero_outside c hw x h))
theorem affineProbabilityProfile_integrable (c : ℝ) {w : ℝ} (hw : 0 < w) : Integrable (affineProbabilityProfile c w) := (affineProbabilityProfile_contDiff c w).continuous.integrable_of_hasCompactSupport (affineProbabilityProfile_compact c hw)
theorem affineProbabilityProfile_integral (c : ℝ) {w : ℝ} (hw : 0 < w) : (∫ x, affineProbabilityProfile c w x) = 1 := by change (∫ x, w⁻¹ * smoothProbabilityProfile ((x-c)/w)) = 1 rw [integral_const_mul, integral_sub_right_eq_self (fun x => smoothProbabilityProfile (x/w)) c, Measure.integral_comp_div, smoothProbabilityProfile_integral, smul_eq_mul, mul_one, abs_of_pos hw, inv_mul_cancel₀ hw.ne']
end Erdos3
end
section
namespace Erdos3
open MeasureTheoryopen scoped BigOperators ContDiff
noncomputable def affineProductProfile {I : Type*} [Fintype I] (c w x : I → ℝ) : ℝ := ∏ i, affineProbabilityProfile (c i) (w i) (x i)
noncomputable def profileWidthFactor {I : Type*} [Fintype I] (w : I → ℝ) : ℝ := ∏ i, (w i)⁻¹
theorem affineProductProfile_eq {I : Type*} [Fintype I] (c w x : I → ℝ) : affineProductProfile c w x = profileWidthFactor w * smoothProductProfile I (fun i => (x i - c i) / w i) := by simp only [affineProductProfile, affineProbabilityProfile, Finset.prod_mul_distrib, profileWidthFactor, smoothProductProfile]
theorem profileWidthFactor_pos {I : Type*} [Fintype I] (w : I → ℝ) (hw : ∀ i, 0 < w i) : 0 < profileWidthFactor w := Finset.prod_pos (fun i _ => inv_pos.mpr (hw i))
theorem affineProductProfile_nonneg {I : Type*} [Fintype I] (c w : I → ℝ) (hw : ∀ i, 0 < w i) (x : I → ℝ) : 0 ≤ affineProductProfile c w x := Finset.prod_nonneg (fun i _ => affineProbabilityProfile_nonneg (c i) (hw i) (x i))
theorem affineProductProfile_norm_le {I : Type*} [Fintype I] (c w : I → ℝ) (hw : ∀ i, 0 < w i) (x : I → ℝ) : ‖affineProductProfile c w x‖ ≤ profileWidthFactor w := by rw [Real.norm_eq_abs, abs_of_nonneg (affineProductProfile_nonneg c w hw x)] exact Finset.prod_le_prod₀ (fun i _ => affineProbabilityProfile_nonneg (c i) (hw i) (x i)) (fun i _ => affineProbabilityProfile_le (c i) (hw i) (x i))
theorem affineProductProfile_contDiff {I : Type*} [Fintype I] (c w : I → ℝ) : ContDiff ℝ ∞ (affineProductProfile c w) := by unfold affineProductProfile apply contDiff_prod intro i _ exact (affineProbabilityProfile_contDiff (c i) (w i)).comp (ContinuousLinearMap.proj i : (I → ℝ) →L[ℝ] ℝ).contDiff
theorem affineProductProfile_compact {I : Type*} [Fintype I] (c w : I → ℝ) (hw : ∀ i, 0 < w i) : HasCompactSupport (affineProductProfile c w) := tensorCutoffWeight_compact (fun i => affineProbabilityProfile (c i) (w i)) (fun i => affineProbabilityProfile_compact (c i) (hw i))
theorem affineProductProfile_integrable {I : Type*} [Fintype I] (c w : I → ℝ) (hw : ∀ i, 0 < w i) : Integrable (affineProductProfile c w) := (affineProductProfile_contDiff c w).continuous.integrable_of_hasCompactSupport (affineProductProfile_compact c w hw)
theorem affineProductProfile_integral {I : Type*} [Fintype I] (c w : I → ℝ) (hw : ∀ i, 0 < w i) : (∫ x, affineProductProfile c w x) = 1 := by change (∫ x, tensorCutoffWeight (fun i => affineProbabilityProfile (c i) (w i)) x) = 1 rw [tensorCutoffWeight_integral] simp only [affineProbabilityProfile_integral _ (hw _), Finset.prod_const_one]
theorem affineProductProfile_zero_outside {I : Type*} [Fintype I] (c w : I → ℝ) (hw : ∀ i, 0 < w i) {R : ℝ} (hR : 0 ≤ R) (hcw : ∀ i, |c i| + w i ≤ R) : ∀ x, R < ‖x‖ → affineProductProfile c w x = 0 := by classical intro x hx by_contra hne apply (not_le_of_gt hx) apply (pi_norm_le_iff_of_nonneg hR).mpr intro i rw [Real.norm_eq_abs] by_contra! hi exact hne (Finset.prod_eq_zero (Finset.mem_univ i) (affineProbabilityProfile_zero_outside (c i) (hw i) (x i) ((hcw i).trans_lt hi)))
end Erdos3
end
section
namespace Erdos3
open MeasureTheory
theorem affineProbabilityProfile_integral_test (c : ℝ) {w : ℝ} (hw : 0 < w) (φ : ℝ → ℝ) : (∫ x, affineProbabilityProfile c w x * φ x) = ∫ y, smoothProbabilityProfile y * φ (c + w*y) := by let g := fun y => smoothProbabilityProfile y * φ (c+w*y) have he (x : ℝ) : affineProbabilityProfile c w x * φ x = w⁻¹ * g ((x-c)/w) := by have hx : c + w*((x-c)/w) = x := by field_simp [hw.ne']; ring simp only [affineProbabilityProfile, g, hx] ring simp_rw [he] rw [integral_const_mul, integral_sub_right_eq_self (fun x => g (x/w)) c, Measure.integral_comp_div, smul_eq_mul, abs_of_pos hw, ← mul_assoc, inv_mul_cancel₀ hw.ne', one_mul]
theorem affineProbabilityProfile_law (c : ℝ) {w : ℝ} (hw : 0 < w) : (realDensityMeasure volume smoothProbabilityProfile).map (fun y => c + w*y) = realDensityMeasure volume (affineProbabilityProfile c w) := by have hψ : Integrable smoothProbabilityProfile := smoothProbabilityProfile_contDiff.continuous.integrable_of_hasCompactSupport smoothProbabilityProfile_compact let : IsFiniteMeasure (realDensityMeasure volume smoothProbabilityProfile) := realDensityMeasure_finite _ _ hψ (fun y => (smoothProbabilityProfile_range y).1) let : IsFiniteMeasure (realDensityMeasure volume (affineProbabilityProfile c w)) := realDensityMeasure_finite _ _ (affineProbabilityProfile_integrable c hw) (affineProbabilityProfile_nonneg c hw) have hmap : Measurable (fun y : ℝ => c+w*y) := by fun_prop apply finiteMeasure_eq_of_integrals intro φ hφ rw [integral_map hmap.aemeasurable hφ.aestronglyMeasurable, realDensityMeasure_integral volume smoothProbabilityProfile smoothProbabilityProfile_contDiff.continuous.measurable (fun y => (smoothProbabilityProfile_range y).1), realDensityMeasure_integral volume (affineProbabilityProfile c w) (affineProbabilityProfile_contDiff c w).continuous.measurable (affineProbabilityProfile_nonneg c hw)] exact (affineProbabilityProfile_integral_test c hw φ).symm
theorem affineProductProfile_law {I : Type*} [Fintype I] (c w : I → ℝ) (hw : ∀ i, 0 < w i) : (realDensityMeasure volume (smoothProductProfile I)).map (fun y i => c i + w i * y i) = realDensityMeasure volume (affineProductProfile c w) := by have hψ : Integrable smoothProbabilityProfile := smoothProbabilityProfile_contDiff.continuous.integrable_of_hasCompactSupport smoothProbabilityProfile_compact let : IsFiniteMeasure (realDensityMeasure volume smoothProbabilityProfile) := realDensityMeasure_finite _ _ hψ (fun y => (smoothProbabilityProfile_range y).1) have hsrc := realDensityMeasure_pi (fun _ : I => (volume : Measure ℝ)) (fun _ => smoothProbabilityProfile) (fun _ => hψ) (fun _ y => (smoothProbabilityProfile_range y).1) have hdst := realDensityMeasure_pi (fun _ : I => (volume : Measure ℝ)) (fun i => affineProbabilityProfile (c i) (w i)) (fun i => affineProbabilityProfile_integrable (c i) (hw i)) (fun i => affineProbabilityProfile_nonneg (c i) (hw i)) change (Measure.pi (fun _ : I => realDensityMeasure volume smoothProbabilityProfile)) = realDensityMeasure volume (smoothProductProfile I) at hsrc change (Measure.pi (fun i : I => realDensityMeasure volume (affineProbabilityProfile (c i) (w i)))) = realDensityMeasure volume (affineProductProfile c w) at hdst rw [← hsrc, Measure.pi_map_pi (fun i => (show Measurable (fun y : ℝ => c i + w i * y) by fun_prop).aemeasurable)] simp_rw [affineProbabilityProfile_law _ (hw _)] exact hdst
end Erdos3
end
section
namespace Erdos3
open MeasureTheory
theorem affineProbabilityProfile_support (c : ℝ) {w : ℝ} (hw : 0 < w) {x : ℝ} (hx : affineProbabilityProfile c w x ≠ 0) : |x - c| < 3 * w / 4 := by by_contra! h have hz : smoothProbabilityProfile ((x-c)/w) = 0 := by apply smoothProbabilityProfile_zero rw [abs_div, abs_of_pos hw] apply (le_div_iff₀ hw).mpr linarith exact hx (by simp only [affineProbabilityProfile, hz, mul_zero])
theorem realDensityMeasure_ae_of_support {X : Type*} [MeasurableSpace X] (μ : Measure X) (f : X → ℝ) (hf : Measurable f) (P : X → Prop) (hP : ∀ x, f x ≠ 0 → P x) : ∀ᵐ x ∂realDensityMeasure μ f, P x := by apply (ae_withDensity_iff hf.ennreal_ofReal).mpr exact Filter.Eventually.of_forall (fun x hx => hP x (fun hz => hx (by simp [hz])))
noncomputable def affineCoefficientMeasure (c w : ℝ) : Measure ℝ := realDensityMeasure volume (affineProbabilityProfile c w)
theorem affineCoefficientMeasure_probability (c : ℝ) {w : ℝ} (hw : 0 < w) : IsProbabilityMeasure (affineCoefficientMeasure c w) := realDensityMeasure_probability volume _ (affineProbabilityProfile_integrable c hw) (affineProbabilityProfile_nonneg c hw) (affineProbabilityProfile_integral c hw)
theorem affineCoefficientMeasure_support (c : ℝ) {w : ℝ} (hw : 0 < w) : ∀ᵐ x ∂affineCoefficientMeasure c w, |x - c| < 3 * w / 4 := realDensityMeasure_ae_of_support volume _ (affineProbabilityProfile_contDiff c w).continuous.measurable _ (fun _ hx => affineProbabilityProfile_support c hw hx)
theorem affineCoefficientMeasure_law (c : ℝ) {w : ℝ} (hw : 0 < w) : (realDensityMeasure volume smoothProbabilityProfile).map (fun y => c + w*y) = affineCoefficientMeasure c w := affineProbabilityProfile_law c hw
end Erdos3
end
section
namespace Erdos3
open MeasureTheoryopen scoped Matrix
theorem affineProductProfile_integral_test {J : Type*} [Fintype J] (c w : J → ℝ) (hw : ∀ j, 0 < w j) (φ : (J → ℝ) → ℝ) (hφ : Measurable φ) : (∫ x, affineProductProfile c w x * φ x) = ∫ r, smoothProductProfile J r * φ (fun j => c j + w j * r j) := by have hmap : Measurable (fun r : J → ℝ => fun j => c j + w j * r j) := by fun_prop rw [← realDensityMeasure_integral volume (affineProductProfile c w) (affineProductProfile_contDiff c w).continuous.measurable (affineProductProfile_nonneg c w hw), ← affineProductProfile_law c w hw, integral_map hmap.aemeasurable hφ.aestronglyMeasurable, realDensityMeasure_integral volume (smoothProductProfile J) (smoothProductProfile_contDiff J).continuous.measurable (fun r => (smoothProductProfile_range J r).1)]
theorem affineProductProfile_retained_integral {Ω J : Type*} [MeasurableSpace Ω] [Fintype J] (μ : Measure Ω) (c w : Ω → J → ℝ) (hw : ∀ ω j, 0 < w ω j) (φ : Ω → (J → ℝ) → ℝ) (hφ : ∀ ω, Measurable (φ ω)) : (∫ ω, (∫ x, affineProductProfile (c ω) (w ω) x * φ ω x) ∂μ) = ∫ ω, (∫ r, smoothProductProfile J r * φ ω (fun j => c ω j + w ω j * r j)) ∂μ := by apply integral_congr_ae exact Filter.Eventually.of_forall (fun ω => affineProductProfile_integral_test (c ω) (w ω) (hw ω) (φ ω) (hφ ω))
theorem affineCoefficientDensity_unit_source {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] (A : Matrix I J ℤ) (s : I ↪ J) (hA : (A.submatrix id s).det ≠ 0) (S : J → ℝ) (P : I → ℝ) (hS : ∀ j, 0 < S j) (hP : ∀ i, 0 < P i) (c w : J → ℝ) (hw : ∀ j, 0 < w j) : (realDensityMeasure volume (smoothProductProfile J)).map (fun r => normalizedIntegerColumns A S P *ᵥ (fun j => c j + w j * r j)) = realDensityMeasure volume (selectedCoefficientDensity A s hA S P hS hP (affineProductProfile c w)) := by have hF : Measurable (fun x => normalizedIntegerColumns A S P *ᵥ x) := (matrixSupCLM (normalizedIntegerColumns A S P)).continuous.measurable have hmap : Measurable (fun r : J → ℝ => fun j => c j + w j * r j) := by fun_prop change ((realDensityMeasure volume (smoothProductProfile J)).map ((fun x => normalizedIntegerColumns A S P *ᵥ x) ∘ (fun r j => c j + w j * r j))) = _ rw [← Measure.map_map hF hmap, affineProductProfile_law c w hw] exact selectedCoefficientDensity_law A s hA S P hS hP _ (affineProductProfile_integrable c w hw) (affineProductProfile_nonneg c w hw)
theorem affineProductProfile_measurable_comp {Ω J : Type*} [MeasurableSpace Ω] [Fintype J] (c w x : Ω → J → ℝ) (hc : Measurable c) (hw : Measurable w) (hx : Measurable x) : Measurable (fun ω => affineProductProfile (c ω) (w ω) (x ω)) := by unfold affineProductProfile affineProbabilityProfile apply Finset.measurable_prod intro j _ exact ((measurable_pi_apply j).comp hw).inv.mul (smoothProbabilityProfile_contDiff.continuous.measurable.comp ((((measurable_pi_apply j).comp hx).sub ((measurable_pi_apply j).comp hc)).div ((measurable_pi_apply j).comp hw)))
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869import OAI.Combinatorics.Progressions.Probability.CoefficientJetDensityFactors
namespace OAI
section
namespace Erdos3
open scoped BigOperators Matrix
variable {I J O : Type*} [Fintype I] [Fintype J]
theorem affineProductProfile_reindex (e : I ≃ J) (c w x : J → ℝ) : affineProductProfile (c ∘ e) (w ∘ e) (x ∘ e) = affineProductProfile c w x := Equiv.prod_comp e (fun j => affineProbabilityProfile (c j) (w j) (x j))
theorem affineCoefficientWeight_reindex (e : I ≃ J) (c w S : J → ℝ) (z : J → ℤ) : coefficientWeight (affineProductProfile (c ∘ e) (w ∘ e)) (S ∘ e) (z ∘ e) = coefficientWeight (affineProductProfile c w) S z := affineProductProfile_reindex e c w (fun j => (z j : ℝ)/S j)
theorem affineCoefficientWeightSum_reindex (e : I ≃ J) (c w S : J → ℝ) : coefficientWeightSum (affineProductProfile (c ∘ e) (w ∘ e)) (S ∘ e) = coefficientWeightSum (affineProductProfile c w) S := by let E : (J → ℤ) ≃ (I → ℤ) := Equiv.arrowCongr e.symm (Equiv.refl ℤ) calc _ = ∑' z : J → ℤ, coefficientWeight (affineProductProfile (c ∘ e) (w ∘ e)) (S ∘ e) (z ∘ e) := (E.tsum_eq _).symm _ = _ := tsum_congr (fun z => affineCoefficientWeight_reindex e c w S z)
theorem coefficientPMF_affine_reindex (e : I ≃ J) (c w S : J → ℝ) (hw : ∀ j, 0 < w j) (hS : ∀ j, 0 < S j) {R : ℝ} (hR : 0 ≤ R) (hcw : ∀ j, |c j|+w j ≤ R) (hZ : 0 < coefficientWeightSum (affineProductProfile c w) S) : (coefficientPMF (affineProductProfile (c ∘ e) (w ∘ e)) (affineProductProfile_nonneg _ _ (fun i => hw (e i))) (S ∘ e) (fun i => hS (e i)) (affineProductProfile_zero_outside _ _ (fun i => hw (e i)) hR (fun i => hcw (e i))) (by rw [affineCoefficientWeightSum_reindex]; exact hZ)).map (fun z => z ∘ e.symm) = coefficientPMF (affineProductProfile c w) (affineProductProfile_nonneg c w hw) S hS (affineProductProfile_zero_outside c w hw hR hcw) hZ := by let E : (I → ℤ) ≃ (J → ℤ) := Equiv.arrowCongr e (Equiv.refl ℤ) change (coefficientPMF _ _ _ _ _ _).map E = _ ext z rw [pmf_map_equiv_apply] apply (ENNReal.toReal_eq_toReal_iff' (PMF.apply_ne_top _ _) (PMF.apply_ne_top _ _)).mp change ((coefficientPMF _ _ _ _ _ _) (z ∘ e)).toReal = _ rw [coefficientPMF_apply, coefficientPMF_apply, affineCoefficientWeight_reindex, affineCoefficientWeightSum_reindex]
theorem coefficientImagePMF_affine_reindex (A : Matrix O J ℤ) (e : I ≃ J) (c w S : J → ℝ) (hw : ∀ j, 0 < w j) (hS : ∀ j, 0 < S j) {R : ℝ} (hR : 0 ≤ R) (hcw : ∀ j, |c j|+w j ≤ R) (hZ : 0 < coefficientWeightSum (affineProductProfile c w) S) : coefficientImagePMF (A.submatrix id e) (affineProductProfile (c ∘ e) (w ∘ e)) (affineProductProfile_nonneg _ _ (fun i => hw (e i))) (S ∘ e) (fun i => hS (e i)) (affineProductProfile_zero_outside _ _ (fun i => hw (e i)) hR (fun i => hcw (e i))) (by rw [affineCoefficientWeightSum_reindex]; exact hZ) = coefficientImagePMF A (affineProductProfile c w) (affineProductProfile_nonneg c w hw) S hS (affineProductProfile_zero_outside c w hw hR hcw) hZ := by unfold coefficientImagePMF rw [← coefficientPMF_affine_reindex e c w S hw hS hR hcw hZ, PMF.map_comp] congr 1 funext z exact Matrix.submatrix_mulVec_equiv A z id e
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553import OAI.Combinatorics.Progressions.Dynamics.LayerRemovalBudgetsimport OAI.Combinatorics.Progressions.Estimates.ModeShiftLengthsimport OAI.Combinatorics.Progressions.Fourier.AffineFrequencyLiftimport OAI.Combinatorics.Progressions.Fourier.LayeredFourierCharacterimport OAI.Combinatorics.Progressions.Polynomial.MonomialCoordinateRows
namespace OAI
section
namespace Erdos3.VectorPolynomial
open scoped BigOperators Classical
theorem integerContractedRow_monomial {K J : Type*} (frequency : (K →₀ ℕ) → J → ℤ) (d : K →₀ ℕ) (j : J) : integerContractedRow frequency (MvPolynomial.monomial d 1) j = frequency d j := by simp [integerContractedRow]
theorem exists_unit_integer_mode_rows {K J : Type*} [Fintype K] [Fintype J] (W : Submodule ℝ (J → ℝ)) (frequency : (K →₀ ℕ) → J → ℤ) {h : ℕ} {C : ℝ} (hbound : ∀ d, d.degree = h → ∀ j, |(frequency d j : ℝ)| ≤ C) (hnonzero : ∃ p, Homogeneous h p ∧ coefficientFunctional (fun d j => (frequency d j : ℝ)) (map W.subtype p) ≠ 0) : ∃ rows : Fin h → K → ℤ, (∀ i k, |(rows i k : ℝ)| ≤ 1) ∧ (∀ j, |(integerContractedRow frequency (∏ i, rowPolynomial (rows i)) j : ℝ)| ≤ C) ∧ ∃ w : W, (∑ j, (integerContractedRow frequency (∏ i, rowPolynomial (rows i)) j : ℝ) * w.val j) ≠ 0 := by obtain ⟨d, hd, w, hw⟩ := exists_restricted_coefficient_nonzero W frequency hnonzero obtain ⟨rows, hrows, hprod⟩ := exists_monomial_coordinate_rows d hd refine ⟨rows, hrows, ?_, ?_⟩ · simpa only [hprod, integerContractedRow_monomial] using hbound d hd · exact ⟨w, by simpa only [hprod, integerContractedRow_monomial] using hw⟩
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomial
open scoped BigOperators
theorem layeredModeTestedPhase_empty_zero {I K : Type*} [Fintype K] {m : ℕ} {W : Fin m → Type*} [∀ j, AddCommGroup (W j)] [∀ j, Module ℝ (W j)] (L : ∀ j, VectorPolynomial K ℝ (W j) →ₗ[ℝ] ℝ) (p : ∀ j, VectorPolynomial I ℝ (W j)) (b : K → I → ℝ) : layeredModeTestedPhase L p 0 (Empty.elim : Empty → K → ℤ) Empty.elim b = layeredCoefficientCharacter L p b := by simp [layeredModeTestedPhase, layeredCoefficientCharacter]
theorem exists_affine_coefficient_local_removal {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) {C : ℝ} (hbound : ∀ j d, d.degree ≤ j.val + 1 → ∀ a, |(frequency j d a : ℝ)| ≤ C) (hbad : ∃ i : Fin m, ∃ P, Homogeneous (i.val + 1) P ∧ affineModeLift (coefficientFunctional (fun d a => (frequency i d a : ℝ))) (map (U i).subtype P) ≠ 0) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (hm : ∀ j d, coefficients (p j) d ∈ U j) (N stride : I → ℕ) (hs : ∀ k, 0 < stride k) {ζ R : ℝ} (hζ : 0 < ζ) (hN : ∀ i : Fin m, ∀ k, multiaffineBiasBudget i.val ζ ≤ N k) (H : I → ℝ) (hH : ∀ k, 0 < H k) {A : ℝ} (hA : 0 ≤ A) (hscale : ∀ k, H k ≤ A * ((stride k : ℝ) * (N k : ℝ))) (hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (hrowBudget : ∀ i : Fin m, ((i.val + 1).factorial : ℝ) * C ≤ R) (hdenom : ∀ i : Fin m, (∏ j : Fin (i.val + 1) → I, (multiaffineBiasBudget i.val ζ * ∏ r, (stride (j r) : ℝ))) ≤ R) (hcoeff : ∀ i : Fin m, (Fintype.card I : ℝ) ^ (i.val + 1) * (A ^ (i.val + 1) * multiaffineBiasBudget i.val ζ) ≤ R) {β : ℝ} (hβ : 0 ≤ β) (hpower : ∀ i : Fin m, ζ ≤ β ^ (2 ^ (i.val + 1))) : ∃ i : Fin m, ∃ rows : Fin (i.val + 1) → Option K → ℤ, (∀ a k, |(rows a k : ℝ)| ≤ 1) ∧ ∀ base : Option K → I → ℝ, ‖𝔼 x : Fin (i.val + 1) → ∀ j, Fin (N j), layeredCoefficientCharacter (fun j => affineModeLift (coefficientFunctional (fun d a => (frequency j d a : ℝ)))) p (rowShiftedTuple base rows (fun (y : ∀ j, Fin (N j)) j => (stride j : ℝ) * ((y j).val : ℝ)) x)‖ ≤ β := by classical let L := fun j => coefficientFunctional (fun d a => (frequency j d a : ℝ)) let site : Empty → K → ℝ := Empty.elim have hf (i : Fin m) := homogeneous_empty_factorization_iff ((affineModeLift (L i)).comp (map (U i).subtype)) (i.val + 1) (fun s (k : Option K) => k.elim 1 (site s)) have hbad' : ∃ i, ¬∃ M : (Empty → U i) →ₗ[ℝ] ℝ, ∀ P, Homogeneous (i.val + 1) P → affineModeLift (L i) (map (U i).subtype P) = M (siteEvaluation (fun s (k : Option K) => k.elim 1 (site s)) P) := by obtain ⟨i, P, hP, hn⟩ := hbad exact ⟨i, fun h => hn ((hf i).mp h P hP)⟩ obtain ⟨i, hi, hfactor⟩ := exists_highest_affine_subspace_nonfactor U site L hbad' have hn := mt (hf i).mpr hi simp only [not_forall, LinearMap.comp_apply] at hn obtain ⟨P, hP, hnP⟩ := hn obtain ⟨rows, hrows, hcontract, hnonzero⟩ := exists_unit_integer_mode_rows (U i) (affineLiftFrequency (frequency i)) (affineLiftFrequency_bound _ (hbound i)) (by exact ⟨P, hP, by simpa only [L, affineModeLift_integerFrequency] using hnP⟩) have hsite : (fun (s : Empty) (k : Option K) => (((Empty.elim s : Option K → ℤ) k : ℤ) : ℝ)) = (fun s (k : Option K) => k.elim 1 (site s)) := Subsingleton.elim _ _ obtain ⟨Q', hQ', test', ht, he⟩ := exists_subspace_layered_mode_reduction i U (fun j => affineModeLift (L j)) p hm hp (Empty.elim : Empty → Option K → ℤ) (by rw [hsite]; exact hfactor) 0 (by simp) Empty.elim (fun s => s.elim) have he' (b : Option K → I → ℝ) : layeredCoefficientCharacter (fun j => affineModeLift (L j)) p b = coefficientModeTestedPhase (coefficientFunctional (fun d a => ((affineLiftFrequency (frequency i) d a : ℤ) : ℝ))) (p i) Q' Empty.elim test' b := by simpa only [layeredModeTestedPhase_empty_zero, L, affineModeLift_integerFrequency] using he b refine ⟨i, rows, hrows, ?_⟩ intro base change ‖𝔼 x : Fin (i.val + 1) → ∀ j, Fin (N j), layeredCoefficientCharacter (fun j => affineModeLift (L j)) p (rowShiftedTuple base rows (fun (y : ∀ j, Fin (N j)) j => (stride j : ℝ) * ((y j).val : ℝ)) x)‖ ≤ β simp_rw [he'] exact inhomogeneous_coefficient_mode_local_removal (affineLiftFrequency (frequency i)) rows (p i) (hp i) (U i) N stride hs hζ (hN i) H hH hA hscale (hrank i) hcontract (hrowBudget i) hnonzero (hdenom i) (hcoeff i) Empty.elim (fun s => s.elim) Q' hQ' test' ht hβ (hpower i) base
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomial
open scoped BigOperators NNReal
theorem affine_coefficient_mode_residue_removal_lipschitz_amplitude {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) {C : ℝ} (hbound : ∀ j d, d.degree ≤ j.val + 1 → ∀ a, |(frequency j d a : ℝ)| ≤ C) (hbad : ∃ i : Fin m, ∃ P, Homogeneous (i.val + 1) P ∧ affineModeLift (coefficientFunctional (fun d a => (frequency i d a : ℝ))) (map (U i).subtype P) ≠ 0) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (hm : ∀ j d, coefficients (p j) d ∈ U j) (N stride : I → ℕ) (hs : ∀ k, 0 < stride k) {ζ R : ℝ} (hζ : 0 < ζ) (hN : ∀ i : Fin m, ∀ k, multiaffineBiasBudget i.val ζ ≤ N k) (H : I → ℝ) (hH : ∀ k, 0 < H k) {A : ℝ} (hA : 0 ≤ A) (hscale : ∀ k, H k ≤ A * ((stride k : ℝ) * (N k : ℝ))) (hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (hrowBudget : ∀ i : Fin m, ((i.val + 1).factorial : ℝ) * C ≤ R) (hdenom : ∀ i : Fin m, (∏ j : Fin (i.val + 1) → I, (multiaffineBiasBudget i.val ζ * ∏ r, (stride (j r) : ℝ))) ≤ R) (hcoeff : ∀ i : Fin m, (Fintype.card I : ℝ) ^ (i.val + 1) * (A ^ (i.val + 1) * multiaffineBiasBudget i.val ζ) ≤ R) (residue : Option K × I → ℤ) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (hZ : 0 < shiftedSmoothProductMass (residueProfileCenter residue stride) (residueProfileWidth stride V)) (hV1 : ∀ z, 1 ≤ residueProfileWidth stride V z) {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) (hmesh : ∀ z, 1 / residueProfileWidth stride V z ≤ δ) (hsmall : (4 : ℝ) ^ Fintype.card (Option K × I) * ((Fintype.card (Option K × I) : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) {r β : ℝ} (hr : 0 ≤ r) (hmove : ∀ i : Fin m, ∀ z, ((i.val + 1 : ℕ) : ℝ) * ((stride z.2 : ℝ) * (N z.2 : ℝ)) ≤ r * V z) (hβ : 0 ≤ β) (hpower : ∀ i : Fin m, ζ ≤ β ^ (2 ^ (i.val + 1))) (F : (Option K × I → ℝ) → ℂ) (hF : ∀ x, ‖F x‖ ≤ 1) {Lip : ℝ≥0} (hLip : LipschitzWith Lip F) : ‖∑' z : Option K × I → ℤ, ((residueSmoothIndexPMF residue stride hs V hV hZ z).toReal : ℂ) * (F (fun t => (residueLatticeArray residue stride z t : ℝ) / V t) * layeredCoefficientCharacter (fun j => affineModeLift (coefficientFunctional (fun d a => (frequency j d a : ℝ)))) p (fun k j => (residueLatticeArray residue stride z (k, j) : ℝ)))‖ ≤ 4 * (3 : ℝ) ^ Fintype.card (Option K × I) * ((Fintype.card (Option K × I) : ℝ) * probabilityProfileLipschitz) * r + (Lip : ℝ) * r + β := by obtain ⟨i, rows, hrows, hlocal⟩ := exists_affine_coefficient_local_removal U frequency hbound hbad p hp hm N stride hs hζ hN H hH hA hscale hrank hrowBudget hdenom hcoeff hβ hpower have hNp k : 0 < N k := by exact_mod_cast (multiaffineBiasBudget_pos i.val hζ).trans_le (hN i k) exact residue_smooth_row_shift_transfer_lipschitz_amplitude N stride hNp hs rows residue V hV hZ hV1 hδ hδ1 hmesh hsmall zero_le_one hrows hr (by simpa only [mul_one] using hmove i) _ (fun b => (layeredCoefficientCharacter_norm _ p b).le) hlocal F hF hLip
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomial
open scoped BigOperators
theorem affine_coefficient_mode_residue_removal {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) {C : ℝ} (hbound : ∀ j d, d.degree ≤ j.val + 1 → ∀ a, |(frequency j d a : ℝ)| ≤ C) (hbad : ∃ i : Fin m, ∃ P, Homogeneous (i.val + 1) P ∧ affineModeLift (coefficientFunctional (fun d a => (frequency i d a : ℝ))) (map (U i).subtype P) ≠ 0) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (hm : ∀ j d, coefficients (p j) d ∈ U j) (N stride : I → ℕ) (hs : ∀ k, 0 < stride k) {ζ R : ℝ} (hζ : 0 < ζ) (hN : ∀ i : Fin m, ∀ k, multiaffineBiasBudget i.val ζ ≤ N k) (H : I → ℝ) (hH : ∀ k, 0 < H k) {A : ℝ} (hA : 0 ≤ A) (hscale : ∀ k, H k ≤ A * ((stride k : ℝ) * (N k : ℝ))) (hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (hrowBudget : ∀ i : Fin m, ((i.val + 1).factorial : ℝ) * C ≤ R) (hdenom : ∀ i : Fin m, (∏ j : Fin (i.val + 1) → I, (multiaffineBiasBudget i.val ζ * ∏ r, (stride (j r) : ℝ))) ≤ R) (hcoeff : ∀ i : Fin m, (Fintype.card I : ℝ) ^ (i.val + 1) * (A ^ (i.val + 1) * multiaffineBiasBudget i.val ζ) ≤ R) (residue : Option K × I → ℤ) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (hZ : 0 < shiftedSmoothProductMass (residueProfileCenter residue stride) (residueProfileWidth stride V)) (hV1 : ∀ z, 1 ≤ residueProfileWidth stride V z) {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) (hmesh : ∀ z, 1 / residueProfileWidth stride V z ≤ δ) (hsmall : (4 : ℝ) ^ Fintype.card (Option K × I) * ((Fintype.card (Option K × I) : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) {r β : ℝ} (hr : 0 ≤ r) (hmove : ∀ i : Fin m, ∀ z, ((i.val + 1 : ℕ) : ℝ) * ((stride z.2 : ℝ) * (N z.2 : ℝ)) ≤ r * V z) (hβ : 0 ≤ β) (hpower : ∀ i : Fin m, ζ ≤ β ^ (2 ^ (i.val + 1))) : ‖∑' z : Option K × I → ℤ, ((residueSmoothIndexPMF residue stride hs V hV hZ z).toReal : ℂ) * layeredCoefficientCharacter (fun j => affineModeLift (coefficientFunctional (fun d a => (frequency j d a : ℝ)))) p (fun k j => (residueLatticeArray residue stride z (k, j) : ℝ))‖ ≤ 4 * (3 : ℝ) ^ Fintype.card (Option K × I) * ((Fintype.card (Option K × I) : ℝ) * probabilityProfileLipschitz) * r + β := by obtain ⟨i, rows, hrows, hlocal⟩ := exists_affine_coefficient_local_removal U frequency hbound hbad p hp hm N stride hs hζ hN H hH hA hscale hrank hrowBudget hdenom hcoeff hβ hpower have hNp k : 0 < N k := by exact_mod_cast (multiaffineBiasBudget_pos i.val hζ).trans_le (hN i k) exact residue_smooth_row_shift_transfer N stride hNp hs rows residue V hV hZ hV1 hδ hδ1 hmesh hsmall zero_le_one hrows hr (by simpa only [mul_one] using hmove i) _ (fun b => (layeredCoefficientCharacter_norm _ p b).le) hlocal
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomial
open scoped BigOperators
theorem anchored_affine_coefficient_mode_residue_removal {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {m : ℕ} (origin : Option K → I → ℝ) {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) {C : ℝ} (hbound : ∀ j d, d.degree ≤ j.val + 1 → ∀ a, |(frequency j d a : ℝ)| ≤ C) (hbad : ∃ i : Fin m, ∃ P, Homogeneous (i.val + 1) P ∧ affineModeLift (coefficientFunctional (fun d a => (frequency i d a : ℝ))) (map (U i).subtype P) ≠ 0) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (hm : ∀ j d, coefficients (p j) d ∈ U j) (N stride : I → ℕ) (hs : ∀ k, 0 < stride k) {ζ R : ℝ} (hζ : 0 < ζ) (hN : ∀ i : Fin m, ∀ k, multiaffineBiasBudget i.val ζ ≤ N k) (H : I → ℝ) (hH : ∀ k, 0 < H k) {A : ℝ} (hA : 0 ≤ A) (hscale : ∀ k, H k ≤ A * ((stride k : ℝ) * (N k : ℝ))) (hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (hrowBudget : ∀ i : Fin m, ((i.val + 1).factorial : ℝ) * C ≤ R) (hdenom : ∀ i : Fin m, (∏ j : Fin (i.val + 1) → I, (multiaffineBiasBudget i.val ζ * ∏ r, (stride (j r) : ℝ))) ≤ R) (hcoeff : ∀ i : Fin m, (Fintype.card I : ℝ) ^ (i.val + 1) * (A ^ (i.val + 1) * multiaffineBiasBudget i.val ζ) ≤ R) (residue : Option K × I → ℤ) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (hZ : 0 < shiftedSmoothProductMass (residueProfileCenter residue stride) (residueProfileWidth stride V)) (hV1 : ∀ z, 1 ≤ residueProfileWidth stride V z) {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) (hmesh : ∀ z, 1 / residueProfileWidth stride V z ≤ δ) (hsmall : (4 : ℝ) ^ Fintype.card (Option K × I) * ((Fintype.card (Option K × I) : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) {r β : ℝ} (hr : 0 ≤ r) (hmove : ∀ i : Fin m, ∀ z, ((i.val + 1 : ℕ) : ℝ) * ((stride z.2 : ℝ) * (N z.2 : ℝ)) ≤ r * V z) (hβ : 0 ≤ β) (hpower : ∀ i : Fin m, ζ ≤ β ^ (2 ^ (i.val + 1))) : ‖∑' z : Option K × I → ℤ, ((residueSmoothIndexPMF residue stride hs V hV hZ z).toReal : ℂ) * layeredCoefficientCharacter (fun j => affineModeLift (coefficientFunctional (fun d a => (frequency j d a : ℝ)))) p (origin + fun k j => (residueLatticeArray residue stride z (k, j) : ℝ))‖ ≤ 4 * (3 : ℝ) ^ Fintype.card (Option K × I) * ((Fintype.card (Option K × I) : ℝ) * probabilityProfileLipschitz) * r + β := by obtain ⟨i, rows, hrows, hlocal⟩ := exists_affine_coefficient_local_removal U frequency hbound hbad p hp hm N stride hs hζ hN H hH hA hscale hrank hrowBudget hdenom hcoeff hβ hpower have hNp k : 0 < N k := by exact_mod_cast (multiaffineBiasBudget_pos i.val hζ).trans_le (hN i k) exact anchored_residue_smooth_row_shift_transfer origin N stride hNp hs rows residue V hV hZ hV1 hδ hδ1 hmesh hsmall zero_le_one hrows hr (by simpa only [mul_one] using hmove i) _ (fun b => (layeredCoefficientCharacter_norm _ p b).le) hlocal
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomial
open scoped BigOperators
def affineCoefficientModeTrivial {K : Type*} {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) : Prop := ∀ j, ∀ P, Homogeneous (j.val + 1) P → affineModeLift (coefficientFunctional (fun d a => (frequency j d a : ℝ))) (map (U j).subtype P) = 0
theorem not_affineCoefficientModeTrivial_iff {K : Type*} {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) : ¬affineCoefficientModeTrivial U frequency ↔ ∃ i : Fin m, ∃ P, Homogeneous (i.val + 1) P ∧ affineModeLift (coefficientFunctional (fun d a => (frequency i d a : ℝ))) (map (U i).subtype P) ≠ 0 := by simp only [affineCoefficientModeTrivial, not_forall, exists_prop]
theorem affineModeLift_zero_of_homogeneous {K W : Type*} [AddCommGroup W] [Module ℝ W] (L : VectorPolynomial K ℝ W →ₗ[ℝ] ℝ) {h : ℕ} (hz : ∀ P, Homogeneous h P → affineModeLift L P = 0) (P : VectorPolynomial (Option K) ℝ W) (hP : DegreeLE (1 : Option K → ℕ) h P) : affineModeLift L P = 0 := by have hf := (affineModeLift_factorization_iff h (Empty.elim : Empty → K → ℝ) L (0 : (Empty → W) →ₗ[ℝ] ℝ)).mp (by simpa only [LinearMap.zero_apply] using hz) exact hf P hP
theorem layeredCoefficientCharacter_eq_one_of_trivial {I K : Type*} [Fintype K] {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) (hz : affineCoefficientModeTrivial U frequency) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (hm : ∀ j d, coefficients (p j) d ∈ U j) (b : Option K → I → ℝ) : layeredCoefficientCharacter (fun j => affineModeLift (coefficientFunctional (fun d a => (frequency j d a : ℝ)))) p b = 1 := by have hzero (j : Fin m) : affineModeLift (coefficientFunctional (fun d a => (frequency j d a : ℝ))) (substitute (fun u => rowPolynomial (fun k => b k u)) (p j)) = 0 := by let p' := restrictCoefficients (U j) (p j) (hm j) have hp' := degreeLE_restrictCoefficients (U j) (p j) (hm j) (hp j) have he := affineModeLift_zero_of_homogeneous ((coefficientFunctional (fun d a => (frequency j d a : ℝ))).comp (map (U j).subtype)) (by simpa only [affineModeLift_comp_map, LinearMap.comp_apply] using hz j) (substitute (fun u => rowPolynomial (fun k => b k u)) p') (degreeLE_substitute_affine _ (fun u => (rowPolynomial_homogeneous (fun k => b k u)).totalDegree_le) p' hp') simpa only [affineModeLift_comp_map, LinearMap.comp_apply, map_substitute, p', map_restrictCoefficients] using he simp only [layeredCoefficientCharacter, hzero, Finset.sum_const_zero, AddCircle.coe_zero, CircleFourier.character_zero]
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomial
open scoped BigOperators NNReal
theorem affine_coefficient_residue_removal_of_widths_lipschitz_amplitude {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) {C : ℝ} (hC : 0 ≤ C) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) (hbound : ∀ j d, d.degree ≤ j.val + 1 → ∀ a, |(frequency j d a : ℝ)| ≤ C) (hbad : ∃ i : Fin m, ∃ P, Homogeneous (i.val + 1) P ∧ affineModeLift (coefficientFunctional (fun d a => (frequency i d a : ℝ))) (map (U i).subtype P) ≠ 0) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (hm : ∀ j d, coefficients (p j) d ∈ U j) (stride : I → ℕ) (hs : ∀ k, 0 < stride k) {ζ R T S : ℝ} (hζ : 0 < ζ) (hT : 0 < T) (hS : 0 ≤ S) (hstride : ∀ k, (stride k : ℝ) ≤ S) (H : I → ℝ) (hH : ∀ k, 0 < H k) (hsize : ∀ k, (stride k : ℝ) * T * (finiteLayerBiasBudget m ζ + 1) ≤ H k) (hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (hR : layerRemovalRankBudget m (Fintype.card I) C 1 (finiteLayerBiasBudget m ζ) (2 * T) S ≤ R) (residue : Option K × I → ℤ) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (hZ : 0 < shiftedSmoothProductMass (residueProfileCenter residue stride) (residueProfileWidth stride V)) (hV1 : ∀ z, 1 ≤ residueProfileWidth stride V z) {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) (hmesh : ∀ z, 1 / residueProfileWidth stride V z ≤ δ) (hsmall : (4 : ℝ) ^ Fintype.card (Option K × I) * ((Fintype.card (Option K × I) : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) {ρ r β : ℝ} (hρ : 0 < ρ) (hr : 0 ≤ r) (hwidth : ∀ z, ρ * H z.2 ≤ V z) (hmove : (m : ℝ) * 1 ≤ r * ρ * T) (hβ : 0 ≤ β) (hpower : ∀ i : Fin m, ζ ≤ β ^ (2 ^ (i.val + 1))) (F : (Option K × I → ℝ) → ℂ) (hF : ∀ x, ‖F x‖ ≤ 1) {Lip : ℝ≥0} (hLip : LipschitzWith Lip F) : ‖∑' z : Option K × I → ℤ, ((residueSmoothIndexPMF residue stride hs V hV hZ z).toReal : ℂ) * (F (fun t => (residueLatticeArray residue stride z t : ℝ) / V t) * layeredCoefficientCharacter (fun j => affineModeLift (coefficientFunctional (fun d a => (frequency j d a : ℝ)))) p (fun k j => (residueLatticeArray residue stride z (k, j) : ℝ)))‖ ≤ 4 * (3 : ℝ) ^ Fintype.card (Option K × I) * ((Fintype.card (Option K × I) : ℝ) * probabilityProfileLipschitz) * r + (Lip : ℝ) * r + β := by classical let B := finiteLayerBiasBudget m ζ let D : ℝ := 1 have hB : 1 ≤ B := finiteLayerBiasBudget_one_le m hζ have hD : 0 ≤ D := zero_le_one have hA : 0 ≤ 2 * T := by positivity have hb (i : Fin m) : multiaffineBiasBudget i.val ζ ≤ B := multiaffineBiasBudget_le_finite i hζ obtain ⟨N, hN, hscale, hshift⟩ := exists_mode_shift_lengths m hT hB hρ hr hmove H stride hs hsize V hwidth have hbud (i : Fin m) := layerRemovalRankBudget_bounds i (Fintype.card I) hC hD (zero_le_one.trans hB) hA hS apply affine_coefficient_mode_residue_removal_lipschitz_amplitude U frequency hbound hbad p hp hm N stride hs hζ (fun i k => (hb i).trans (hN k)) H hH hA hscale hrank (fun i => by simpa only [D, one_pow, mul_one] using (hbud i).1.trans hR) _ _ residue V hV hZ hV1 hδ hδ1 hmesh hsmall hr _ hβ hpower F hF hLip · intro i have hi := tensorDenominatorBound_le (H := Fin (i.val + 1)) (multiaffineBiasBudget_pos i.val hζ).le (fun k => (stride k : ℝ)) (fun k => Nat.cast_nonneg _) hstride have hi' : (∏ j : Fin (i.val + 1) → I, (multiaffineBiasBudget i.val ζ * ∏ r, (stride (j r) : ℝ))) ≤ (multiaffineBiasBudget i.val ζ * S ^ (i.val + 1)) ^ (Fintype.card I ^ (i.val + 1)) := by simpa only [Fintype.card_fin] using hi apply hi'.trans apply le_trans _ ((hbud i).2.1.trans hR) exact pow_le_pow_left₀ (mul_nonneg (multiaffineBiasBudget_pos i.val hζ).le (pow_nonneg hS _)) (mul_le_mul_of_nonneg_right (hb i) (pow_nonneg hS _)) _ · intro i apply le_trans _ ((hbud i).2.2.trans hR) exact mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left (hb i) (pow_nonneg hA _)) (pow_nonneg (Nat.cast_nonneg _) _) · intro i z have hi : ((i.val + 1 : ℕ) : ℝ) ≤ m := by exact_mod_cast Nat.succ_le_of_lt i.isLt have hs' : (m : ℝ) * ((stride z.2 : ℝ) * (N z.2 : ℝ)) ≤ r * V z := by simpa only [mul_one] using hshift z exact (mul_le_mul_of_nonneg_right hi (mul_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _))).trans hs'
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomial
open scoped BigOperators NNReal
theorem affine_coefficient_residue_removal_of_widths {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) {C : ℝ} (hC : 0 ≤ C) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) (hbound : ∀ j d, d.degree ≤ j.val + 1 → ∀ a, |(frequency j d a : ℝ)| ≤ C) (hbad : ∃ i : Fin m, ∃ P, Homogeneous (i.val + 1) P ∧ affineModeLift (coefficientFunctional (fun d a => (frequency i d a : ℝ))) (map (U i).subtype P) ≠ 0) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (hm : ∀ j d, coefficients (p j) d ∈ U j) (stride : I → ℕ) (hs : ∀ k, 0 < stride k) {ζ R T S : ℝ} (hζ : 0 < ζ) (hT : 0 < T) (hS : 0 ≤ S) (hstride : ∀ k, (stride k : ℝ) ≤ S) (H : I → ℝ) (hH : ∀ k, 0 < H k) (hsize : ∀ k, (stride k : ℝ) * T * (finiteLayerBiasBudget m ζ + 1) ≤ H k) (hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (hR : layerRemovalRankBudget m (Fintype.card I) C 1 (finiteLayerBiasBudget m ζ) (2 * T) S ≤ R) (residue : Option K × I → ℤ) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (hZ : 0 < shiftedSmoothProductMass (residueProfileCenter residue stride) (residueProfileWidth stride V)) (hV1 : ∀ z, 1 ≤ residueProfileWidth stride V z) {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) (hmesh : ∀ z, 1 / residueProfileWidth stride V z ≤ δ) (hsmall : (4 : ℝ) ^ Fintype.card (Option K × I) * ((Fintype.card (Option K × I) : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) {ρ r β : ℝ} (hρ : 0 < ρ) (hr : 0 ≤ r) (hwidth : ∀ z, ρ * H z.2 ≤ V z) (hmove : (m : ℝ) * 1 ≤ r * ρ * T) (hβ : 0 ≤ β) (hpower : ∀ i : Fin m, ζ ≤ β ^ (2 ^ (i.val + 1))) : ‖∑' z : Option K × I → ℤ, ((residueSmoothIndexPMF residue stride hs V hV hZ z).toReal : ℂ) * layeredCoefficientCharacter (fun j => affineModeLift (coefficientFunctional (fun d a => (frequency j d a : ℝ)))) p (fun k j => (residueLatticeArray residue stride z (k, j) : ℝ))‖ ≤ 4 * (3 : ℝ) ^ Fintype.card (Option K × I) * ((Fintype.card (Option K × I) : ℝ) * probabilityProfileLipschitz) * r + β := by classical let B := finiteLayerBiasBudget m ζ let D : ℝ := 1 have hB : 1 ≤ B := finiteLayerBiasBudget_one_le m hζ have hD : 0 ≤ D := zero_le_one have hA : 0 ≤ 2 * T := by positivity have hb (i : Fin m) : multiaffineBiasBudget i.val ζ ≤ B := multiaffineBiasBudget_le_finite i hζ obtain ⟨N, hN, hscale, hshift⟩ := exists_mode_shift_lengths m hT hB hρ hr hmove H stride hs hsize V hwidth have hbud (i : Fin m) := layerRemovalRankBudget_bounds i (Fintype.card I) hC hD (zero_le_one.trans hB) hA hS apply affine_coefficient_mode_residue_removal U frequency hbound hbad p hp hm N stride hs hζ (fun i k => (hb i).trans (hN k)) H hH hA hscale hrank (fun i => by simpa only [D, one_pow, mul_one] using (hbud i).1.trans hR) _ _ residue V hV hZ hV1 hδ hδ1 hmesh hsmall hr _ hβ hpower · intro i have hi := tensorDenominatorBound_le (H := Fin (i.val + 1)) (multiaffineBiasBudget_pos i.val hζ).le (fun k => (stride k : ℝ)) (fun k => Nat.cast_nonneg _) hstride have hi' : (∏ j : Fin (i.val + 1) → I, (multiaffineBiasBudget i.val ζ * ∏ r, (stride (j r) : ℝ))) ≤ (multiaffineBiasBudget i.val ζ * S ^ (i.val + 1)) ^ (Fintype.card I ^ (i.val + 1)) := by simpa only [Fintype.card_fin] using hi apply hi'.trans apply le_trans _ ((hbud i).2.1.trans hR) exact pow_le_pow_left₀ (mul_nonneg (multiaffineBiasBudget_pos i.val hζ).le (pow_nonneg hS _)) (mul_le_mul_of_nonneg_right (hb i) (pow_nonneg hS _)) _ · intro i apply le_trans _ ((hbud i).2.2.trans hR) exact mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left (hb i) (pow_nonneg hA _)) (pow_nonneg (Nat.cast_nonneg _) _) · intro i z have hi : ((i.val + 1 : ℕ) : ℝ) ≤ m := by exact_mod_cast Nat.succ_le_of_lt i.isLt have hs' : (m : ℝ) * ((stride z.2 : ℝ) * (N z.2 : ℝ)) ≤ r * V z := by simpa only [mul_one] using hshift z exact (mul_le_mul_of_nonneg_right hi (mul_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _))).trans hs'
end Erdos3.VectorPolynomial
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584import OAI.Combinatorics.Progressions.Estimates.BoundedAmbientModeWitnessimport OAI.Combinatorics.Progressions.Estimates.OrderedLayerSplitimport OAI.Combinatorics.Progressions.Polynomial.PolynomialSiteAbsorption
namespace OAI
section
namespace Erdos3.VectorPolynomial
open scoped BigOperators TensorProduct Classical
noncomputable def integerContractedRow {σ J : Type*} (frequency : (σ →₀ ℕ) → J → ℤ) (P : MvPolynomial σ ℤ) : J → ℤ := fun j => ∑ d ∈ P.support, P.coeff d * frequency d j
theorem integerContractedRow_cast {σ J : Type*} (Λ : VectorPolynomial σ ℝ (J → ℝ) →ₗ[ℝ] ℝ) (frequency : (σ →₀ ℕ) → J → ℤ) {h : ℕ} (hfrequency : ∀ d : σ →₀ ℕ, d.degree = h → ∀ j, Λ (MvPolynomial.monomial d 1 ⊗ₜ[ℝ] Pi.single j 1) = (frequency d j : ℝ)) {P : MvPolynomial σ ℤ} (hP : P.IsHomogeneous h) (j : J) : (integerContractedRow frequency P j : ℝ) = contractedRow Λ (MvPolynomial.map (Int.castRingHom ℝ) P) j := by change _ = ((TensorProduct.curry Λ).flip (Pi.single j 1)) (MvPolynomial.map (Int.castRingHom ℝ) P) rw [polynomialFunctional_map_expansion] simp only [integerContractedRow, Int.cast_sum, Int.cast_mul, Int.coe_castRingHom] apply Finset.sum_congr rfl intro d hd have hdeg : d.degree = h := by simpa only [Finsupp.degree_eq_weight_one, Pi.one_def] using hP (MvPolynomial.mem_support_iff.mp hd) change _ = ((P.coeff d : ℤ) : ℝ) * Λ (MvPolynomial.monomial d 1 ⊗ₜ[ℝ] Pi.single j 1) rw [hfrequency d hdeg j]
theorem integerContractedRow_coefficientFunctional {σ J : Type*} [Fintype J] (frequency : (σ →₀ ℕ) → J → ℤ) {P : MvPolynomial σ ℤ} {h : ℕ} (hP : P.IsHomogeneous h) (j : J) : (integerContractedRow frequency P j : ℝ) = contractedRow (coefficientFunctional (fun d j => (frequency d j : ℝ))) (MvPolynomial.map (Int.castRingHom ℝ) P) j := integerContractedRow_cast _ frequency (fun d _ j => coefficientFunctional_unit _ d j) hP j
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.BooleanCubeKernel
open scoped BigOperators Classical
theorem integer_cube_root_bound {K : Type*} {q : ℕ} (root : K → ℤ) (difference : Fin q → K → ℤ) {L : ℝ} (hsite : ∀ (s : Finset (Fin q)) k, |((affineSite root difference s (some k) : ℤ) : ℝ)| ≤ L) : ∀ k, |(root k : ℝ)| ≤ L := by intro k simpa only [affineSite, Finset.sum_empty, add_zero] using hsite ∅ k
theorem integer_cube_difference_bound {K : Type*} {q : ℕ} (root : K → ℤ) (difference : Fin q → K → ℤ) {L : ℝ} (hsite : ∀ (s : Finset (Fin q)) k, |((affineSite root difference s (some k) : ℤ) : ℝ)| ≤ L) : ∀ i k, |(difference i k : ℝ)| ≤ 2 * L := by intro i k have he : (difference i k : ℝ) = ((affineSite root difference {i} (some k) : ℤ) : ℝ) - (root k : ℝ) := by simp [affineSite] rw [he] have ht := hsite {i} k have hr := integer_cube_root_bound root difference hsite k exact (abs_sub _ _).trans (by linarith)
end Erdos3.BooleanCubeKernel
end
section
namespace Erdos3.BooleanCubeKernel
theorem integerCubeWitnessBound_le_polynomial (q : ℕ) {H D : ℝ} (hH : 0 ≤ H) (hD : 0 ≤ D) : integerCubeWitnessBound q H D ≤ (q.factorial : ℝ) * (2 + (q : ℝ) * (q + 1)) * (1 + H + D) ^ (q + 2) := by let M := 1 + H + D have hM : 1 ≤ M := by dsimp [M]; linarith have hDq : D ^ q ≤ M ^ q := pow_le_pow_left₀ hD (by dsimp [M]; linarith) q have hDm : D ^ (q - 1) ≤ M ^ q := (pow_le_pow_left₀ hD (by dsimp [M]; linarith) (q - 1)).trans (pow_le_pow_right₀ hM (Nat.sub_le _ _)) have hHM : 1 + H ≤ M := by dsimp [M]; linarith have hA : (q.factorial : ℝ) * D ^ q ≤ (q.factorial : ℝ) * M ^ q := mul_le_mul_of_nonneg_left hDq (Nat.cast_nonneg _) have hB : (q : ℝ) * ((q.factorial : ℝ) * D ^ (q - 1) * (1 + H)) ≤ (q : ℝ) * (q.factorial : ℝ) * M ^ (q + 1) := by calc _ ≤ (q : ℝ) * ((q.factorial : ℝ) * M ^ q * M) := by gcongr _ = _ := by rw [pow_succ]; ring have hfactor : (q : ℝ) * D + 1 ≤ ((q : ℝ) + 1) * M := by have hd : D ≤ M := by dsimp [M]; linarith nlinarith [show (0 : ℝ) ≤ (q : ℝ) from Nat.cast_nonneg q] have hbase : 2 + H ≤ 2 * M := by dsimp [M]; linarith have hpow : M ^ (q + 1) ≤ M ^ (q + 2) := pow_le_pow_right₀ hM (by omega) unfold integerCubeWitnessBound integerFormMassBound calc _ ≤ (q.factorial : ℝ) * M ^ q * (2 * M) + (((q : ℝ) + 1) * M) * ((q : ℝ) * (q.factorial : ℝ) * M ^ (q + 1)) := by exact add_le_add (mul_le_mul hA hbase (by positivity) (by positivity)) (mul_le_mul hfactor hB (by positivity) (by positivity)) _ = 2 * (q.factorial : ℝ) * M ^ (q + 1) + ((q : ℝ) * (q + 1) * (q.factorial : ℝ)) * M ^ (q + 2) := by simp only [pow_succ] ring _ ≤ 2 * (q.factorial : ℝ) * M ^ (q + 2) + ((q : ℝ) * (q + 1) * (q.factorial : ℝ)) * M ^ (q + 2) := by gcongr _ = _ := by dsimp [M]; ring
end Erdos3.BooleanCubeKernel
end
section
namespace Erdos3.BooleanCubeKernel
open MvPolynomialopen scoped BigOperators TensorProduct Classical
theorem exists_bounded_integer_mode_witness {K J : Type*} [Fintype K] [Fintype J] {q : ℕ} (W : Submodule ℝ (J → ℝ)) (root : K → ℤ) (difference : Fin q → K → ℤ) (hlin : LinearIndependent ℝ (fun i k => (difference i k : ℝ))) {H D C : ℝ} (hH : 0 ≤ H) (hD : 0 ≤ D) (hC : 0 ≤ C) (hroot : ∀ k, |(root k : ℝ)| ≤ H) (hdiff : ∀ i k, |(difference i k : ℝ)| ≤ D) (frequency : ((Option K) →₀ ℕ) → J → ℤ) (h : ℕ) (hbound : ∀ d, d.degree = h → ∀ j, |(frequency d j : ℝ)| ≤ C) (hnonfactor : ¬ ∃ M : (Finset (Fin q) → W) →ₗ[ℝ] ℝ, ∀ p, VectorPolynomial.Homogeneous h p → VectorPolynomial.coefficientFunctional (fun d j => (frequency d j : ℝ)) (VectorPolynomial.map W.subtype p) = M (VectorPolynomial.siteEvaluation (fun s => affineSite (fun k => (root k : ℝ)) (fun i k => (difference i k : ℝ)) s) p)) : ∃ P : Fin h → MvPolynomial (Option K) ℤ, (∀ i, (P i).IsHomogeneous 1 ∧ realPolynomialMass (map (Int.castRingHom ℝ) (P i)) ≤ integerCubeWitnessBound q H D) ∧ (∀ s : Finset (Fin q), ∃ i, eval (affineSite root difference s) (P i) = 0) ∧ (∀ j, |(VectorPolynomial.integerContractedRow frequency (∏ i, P i) j : ℝ)| ≤ C * integerCubeWitnessBound q H D ^ h) ∧ ∃ w : W, (∑ j, (VectorPolynomial.integerContractedRow frequency (∏ i, P i) j : ℝ) * w.val j) ≠ 0 := by obtain ⟨P, hP, hz, hb, w, hw⟩ := exists_bounded_ambient_mode_witness W root difference hlin hH hD hC hroot hdiff (VectorPolynomial.coefficientFunctional (fun d j => (frequency d j : ℝ))) h (VectorPolynomial.coefficientFunctional_rowBound _ hbound) hnonfactor have hp : (∏ i, P i).IsHomogeneous h := by simpa using IsHomogeneous.prod Finset.univ P (fun _ => 1) (fun i _ => (hP i).1) have hcast (j : J) := VectorPolynomial.integerContractedRow_coefficientFunctional frequency hp j refine ⟨P, hP, hz, ?_, w, ?_⟩ · intro j rw [hcast j] exact hb j · simp_rw [hcast] exact hw
end Erdos3.BooleanCubeKernel
end
section
namespace Erdos3
open MvPolynomialopen scoped BigOperators TensorProduct Classical
theorem rowPolynomial_homogeneous {σ R : Type*} [Fintype σ] [CommRing R] (a : σ → R) : (rowPolynomial a).IsHomogeneous 1 := IsHomogeneous.sum Finset.univ _ 1 (fun i _ => isHomogeneous_C_mul_X (a i) i)
theorem VectorPolynomial.integerContractedRow_apply {σ J : Type*} [Fintype J] (frequency : (σ →₀ ℕ) → J → ℤ) {P : MvPolynomial σ ℤ} {h : ℕ} (hP : P.IsHomogeneous h) (w : J → ℝ) : (∑ j, (integerContractedRow frequency P j : ℝ) * w j) = coefficientFunctional (fun d j => (frequency d j : ℝ)) ((MvPolynomial.map (Int.castRingHom ℝ) P) ⊗ₜ[ℝ] w) := by simp_rw [integerContractedRow_coefficientFunctional frequency hP] exact contractedRow_apply _ _ w
namespace BooleanCubeKernel
theorem exists_bounded_integer_mode_rows {K J : Type*} [Fintype K] [Fintype J] {q : ℕ} (W : Submodule ℝ (J → ℝ)) (root : K → ℤ) (difference : Fin q → K → ℤ) (hlin : LinearIndependent ℝ (fun i k => (difference i k : ℝ))) {H D C : ℝ} (hH : 0 ≤ H) (hD : 0 ≤ D) (hC : 0 ≤ C) (hroot : ∀ k, |(root k : ℝ)| ≤ H) (hdiff : ∀ i k, |(difference i k : ℝ)| ≤ D) (frequency : ((Option K) →₀ ℕ) → J → ℤ) (h : ℕ) (hbound : ∀ d, d.degree = h → ∀ j, |(frequency d j : ℝ)| ≤ C) (hnonfactor : ¬ ∃ M : (Finset (Fin q) → W) →ₗ[ℝ] ℝ, ∀ p, VectorPolynomial.Homogeneous h p → VectorPolynomial.coefficientFunctional (fun d j => (frequency d j : ℝ)) (VectorPolynomial.map W.subtype p) = M (VectorPolynomial.siteEvaluation (fun s => affineSite (fun k => (root k : ℝ)) (fun i k => (difference i k : ℝ)) s) p)) : ∃ rows : Fin h → Option K → ℤ, (∀ i k, |(rows i k : ℝ)| ≤ integerCubeWitnessBound q H D) ∧ (∀ s : Finset (Fin q), ∃ i, (∑ k, rows i k * affineSite root difference s k) = 0) ∧ (∀ j, |(VectorPolynomial.integerContractedRow frequency (∏ i, rowPolynomial (rows i)) j : ℝ)| ≤ C * integerCubeWitnessBound q H D ^ h) ∧ ∃ w : W, (∑ j, (VectorPolynomial.integerContractedRow frequency (∏ i, rowPolynomial (rows i)) j : ℝ) * w.val j) ≠ 0 := by obtain ⟨P, hP, hz, hb, hw⟩ := exists_bounded_integer_mode_witness W root difference hlin hH hD hC hroot hdiff frequency h hbound hnonfactor let rows := fun i => polynomialLinearRow (P i) have hp (i : Fin h) : rowPolynomial (rows i) = P i := (homogeneous_eq_rowPolynomial _ (hP i).1).symm have hprod : (∏ i, rowPolynomial (rows i)) = ∏ i, P i := by simp_rw [hp] refine ⟨rows, ?_, ?_, ?_, ?_⟩ · intro i k exact (integer_coefficient_le_mass (P i) (Finsupp.single k 1)).trans (hP i).2 · intro s obtain ⟨i, hi⟩ := hz s refine ⟨i, ?_⟩ change (∑ k, polynomialLinearRow (P i) k * affineSite root difference s k) = 0 rw [← homogeneous_eval_eq_row _ (hP i).1] exact hi · rw [hprod] exact hb · rw [hprod] exact hw
end BooleanCubeKernelend Erdos3
end
section
namespace Erdos3.VectorPolynomial
open scoped BigOperators
noncomputable def affineParameterSubstitution {I K : Type*} [Fintype K] (b : Option K → I → ℝ) (j : I) : MvPolynomial K ℝ := MvPolynomial.C (b none j) + rowPolynomial (fun k => b (some k) j)
theorem dehomogenize_rowPolynomial {K : Type*} [Fintype K] (a : Option K → ℝ) : MvPolynomial.aeval dehomogenizingSubstitution (rowPolynomial a) = MvPolynomial.C (a none) + rowPolynomial (fun k => a (some k)) := by simp [rowPolynomial, dehomogenizingSubstitution, Fintype.sum_option]
theorem affineParameterSubstitution_degree {I K : Type*} [Fintype K] (b : Option K → I → ℝ) (j : I) : (affineParameterSubstitution b j).totalDegree ≤ 1 := by apply (MvPolynomial.totalDegree_add _ _).trans exact max_le (by simp) (rowPolynomial_homogeneous (fun k => b (some k) j)).totalDegree_le
theorem affineParameterSubstitution_eval {I K : Type*} [Fintype K] (b : Option K → I → ℝ) (t : K → ℝ) (j : I) : MvPolynomial.aeval t (affineParameterSubstitution b j) = b none j + ∑ k, b (some k) j * t k := by change MvPolynomial.eval t (affineParameterSubstitution b j) = _ rw [affineParameterSubstitution, map_add, MvPolynomial.eval_C, rowPolynomial_eval]
noncomputable def affineModeLift {K W : Type*} [AddCommGroup W] [Module ℝ W] (Λ : VectorPolynomial K ℝ W →ₗ[ℝ] ℝ) : VectorPolynomial (Option K) ℝ W →ₗ[ℝ] ℝ := Λ.comp (substitute dehomogenizingSubstitution)
theorem affineModeLift_substitute {I K W : Type*} [Fintype K] [AddCommGroup W] [Module ℝ W] (Λ : VectorPolynomial K ℝ W →ₗ[ℝ] ℝ) (p : VectorPolynomial I ℝ W) (b : Option K → I → ℝ) : affineModeLift Λ (substitute (fun j => rowPolynomial (fun k => b k j)) p) = Λ (substitute (affineParameterSubstitution b) p) := by rw [affineModeLift, LinearMap.comp_apply, substitute_comp] simp only [dehomogenize_rowPolynomial] rfl
theorem coefficientModePolynomial_affine_eval {I K W : Type*} [Fintype K] [AddCommGroup W] [Module ℝ W] (Λ : VectorPolynomial K ℝ W →ₗ[ℝ] ℝ) (p : VectorPolynomial I ℝ W) (b : Option K → I → ℝ) : MvPolynomial.eval (fun z => b z.1 z.2) (coefficientModePolynomial (affineModeLift Λ) p) = Λ (substitute (affineParameterSubstitution b) p) := by rw [coefficientModePolynomial_eval, affineModeLift_substitute]
theorem coefficientModePolynomial_degreeLE {I K W : Type*} [Fintype K] [AddCommGroup W] [Module ℝ W] (L : VectorPolynomial K ℝ W →ₗ[ℝ] ℝ) (p : VectorPolynomial I ℝ W) {h : ℕ} (hp : DegreeLE (1 : I → ℕ) h p) : (coefficientModePolynomial L p).totalDegree ≤ h := by unfold coefficientModePolynomial apply MvPolynomial.totalDegree_finsetSum_le intro d hd apply (mapPolynomialCoefficients_degree _ _).trans apply parameterPolynomialPullback_degree have hb : d.sum (fun _ n => n) ≤ h := by simpa only [Finsupp.weight_apply, Pi.one_def, smul_eq_mul, mul_one] using (degreeLE_iff (1 : I → ℕ) h p).mp hp d hd exact (MvPolynomial.totalDegree_monomial_le d 1).trans hb
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomial
open CircleFourieropen scoped BigOperators
theorem rowPolynomial_integer_site {I K : Type*} [Fintype K] (site : K → ℤ) (b : K → I → ℝ) : (fun i => MvPolynomial.aeval (fun k => (site k : ℝ)) (rowPolynomial (fun k => b k i))) = integerSiteValue site b := by funext i change MvPolynomial.eval (fun k => (site k : ℝ)) (rowPolynomial (fun k => b k i)) = _ rw [rowPolynomial_eval] change (∑ k, b k i * (site k : ℝ)) = (∑ k, site k • b k) i rw [Finset.sum_apply] apply Finset.sum_congr rfl intro k _ change b k i * (site k : ℝ) = site k • b k i rw [zsmul_eq_mul, mul_comm]
theorem exists_absorbed_integer_site_tests {A I K S : Type*} {W : A → Type*} [Fintype A] [Fintype K] [Fintype S] [DecidableEq S] [∀ a, AddCommGroup (W a)] [∀ a, Module ℝ (W a)] (h : A → ℕ) (site : S → K → ℤ) (L : ∀ a, VectorPolynomial K ℝ (W a) →ₗ[ℝ] ℝ) (hfactor : ∀ a, ∃ M : (S → W a) →ₗ[ℝ] ℝ, ∀ q, DegreeLE (1 : K → ℕ) (h a) q → L a q = M (siteEvaluation (fun s k => (site s k : ℝ)) q)) (p : ∀ a, VectorPolynomial I ℝ (W a)) (hp : ∀ a, DegreeLE (1 : I → ℕ) (h a) (p a)) (low : (K → I → ℝ) → ℝ) (test : S ��� (I → ℝ) → ℂ) (htest : ∀ s x, ‖test s x‖ ≤ 1) : ∃ test' : S → (I → ℝ) → ℂ, (∀ s x, ‖test' s x‖ ≤ 1) ∧ ∀ b, character ((low b + ∑ a, L a (substitute (fun i => rowPolynomial (fun k => b k i)) (p a)) : ℝ) : CircleFourier.Circle) * (∏ s, test s (integerSiteValue (site s) b)) = character (low b : CircleFourier.Circle) * (∏ s, test' s (integerSiteValue (site s) b)) := by have hf (a : A) : ∃ M : (S → W a) →ₗ[ℝ] ℝ, ∀ q, Homogeneous (h a) q → L a (substitute dehomogenizingSubstitution q) = M (siteEvaluation (fun s (k : Option K) => k.elim 1 (fun k => (site s k : ℝ))) q) := by obtain ⟨M, hM⟩ := hfactor a exact ⟨M, (homogeneous_site_factorization_iff (h a) (fun s k => (site s k : ℝ)) (L a) M).mpr hM⟩ obtain ⟨test', ht, he⟩ := exists_absorbed_polynomial_site_tests h (fun s k => (site s k : ℝ)) L hf p hp (fun (b : K → I → ℝ) i => rowPolynomial (fun k => b k i)) (fun b i => (rowPolynomial_homogeneous (fun k => b k i)).totalDegree_le) low test htest refine ⟨test', ht, ?_⟩ intro b simpa only [rowPolynomial_integer_site] using he b
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.BooleanCubeKernel
open MvPolynomialopen scoped BigOperators TensorProduct Classical
def cubeModePolynomialBudget (q : ℕ) (L : ℝ) : ℝ := (q.factorial : ℝ) * (2 + (q : ℝ) * (q + 1)) * (1 + 3 * L) ^ (q + 2)
theorem integerCubeWitnessBound_le_vertex_budget (q : ℕ) {L : ℝ} (hL : 0 ≤ L) : integerCubeWitnessBound q L (2 * L) ≤ cubeModePolynomialBudget q L := by have he : 1 + L + 2 * L = 1 + 3 * L := by ring simpa only [cubeModePolynomialBudget, he] using integerCubeWitnessBound_le_polynomial q hL (show 0 ≤ 2 * L by positivity)
theorem exists_vertex_bounded_integer_mode {K J : Type*} [Fintype K] [Fintype J] {q : ℕ} (W : Submodule ℝ (J → ℝ)) (root : K → ℤ) (difference : Fin q → K → ℤ) (hlin : LinearIndependent ℝ (fun i k => (difference i k : ℝ))) {L C : ℝ} (hL : 0 ≤ L) (hC : 0 ≤ C) (hsite : ∀ (s : Finset (Fin q)) k, |((affineSite root difference s (some k) : ℤ) : ℝ)| ≤ L) (frequency : ((Option K) →₀ ℕ) → J → ℤ) (h : ℕ) (hbound : ∀ d, d.degree = h → ∀ j, |(frequency d j : ℝ)| ≤ C) (hnonfactor : ¬ ∃ M : (Finset (Fin q) → W) →ₗ[ℝ] ℝ, ∀ p, VectorPolynomial.Homogeneous h p → VectorPolynomial.coefficientFunctional (fun d j => (frequency d j : ℝ)) (VectorPolynomial.map W.subtype p) = M (VectorPolynomial.siteEvaluation (fun s => affineSite (fun k => (root k : ℝ)) (fun i k => (difference i k : ℝ)) s) p)) : ∃ rows : Fin h → Option K → ℤ, (∀ i k, |(rows i k : ℝ)| ≤ cubeModePolynomialBudget q L) ∧ (∀ s : Finset (Fin q), ∃ i, (∑ k, rows i k * affineSite root difference s k) = 0) ∧ (∀ j, |(VectorPolynomial.integerContractedRow frequency (∏ i, rowPolynomial (rows i)) j : ℝ)| ≤ C * cubeModePolynomialBudget q L ^ h) ∧ ∃ w : W, (∑ j, (VectorPolynomial.integerContractedRow frequency (∏ i, rowPolynomial (rows i)) j : ℝ) * w.val j) ≠ 0 := by obtain ⟨rows, hr, hz, hb, hw⟩ := exists_bounded_integer_mode_rows W root difference hlin hL (show 0 ≤ 2 * L by positivity) hC (integer_cube_root_bound root difference hsite) (integer_cube_difference_bound root difference hsite) frequency h hbound hnonfactor have hbudget := integerCubeWitnessBound_le_vertex_budget q hL refine ⟨rows, (fun i k => (hr i k).trans hbudget), hz, ?_, hw⟩ intro j exact (hb j).trans (mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (integerCubeWitnessBound_nonneg q hL (by positivity)) hbudget h) hC)
end Erdos3.BooleanCubeKernel
end
section
namespace Erdos3.VectorPolynomial
theorem degreeLE_dehomogenize {K W : Type*} [AddCommGroup W] [Module ℝ W] {h : ℕ} {p : VectorPolynomial (Option K) ℝ W} (hp : DegreeLE (1 : Option K → ℕ) h p) : DegreeLE (1 : K → ℕ) h (substitute dehomogenizingSubstitution p) := by apply degreeLE_substitute_affine _ _ p hp intro k cases k <;> simp [dehomogenizingSubstitution]
theorem affineModeLift_factorization_iff {K S W : Type*} [AddCommGroup W] [Module ℝ W] (h : ℕ) (site : S → K → ℝ) (L : VectorPolynomial K ℝ W →ₗ[ℝ] ℝ) (M : (S → W) →ₗ[ℝ] ℝ) : (∀ q, Homogeneous h q → affineModeLift L q = M (siteEvaluation (fun s (k : Option K) => k.elim 1 (site s)) q)) ↔ (∀ q, DegreeLE (1 : Option K → ℕ) h q → affineModeLift L q = M (siteEvaluation (fun s (k : Option K) => k.elim 1 (site s)) q)) := by constructor · intro hf q hq have ho := (homogeneous_site_factorization_iff h site L M).mp hf change L (substitute dehomogenizingSubstitution q) = _ rw [← siteEvaluation_dehomogenize] exact ho _ (degreeLE_dehomogenize hq) · intro hf q hq exact hf q (homogeneous_degreeLE hq)
theorem affineModeLift_exists_factorization_iff {K S W : Type*} [AddCommGroup W] [Module ℝ W] (h : ℕ) (site : S → K → ℝ) (L : VectorPolynomial K ℝ W →ₗ[ℝ] ℝ) : (∃ M : (S → W) →ₗ[ℝ] ℝ, ∀ q, Homogeneous h q → affineModeLift L q = M (siteEvaluation (fun s (k : Option K) => k.elim 1 (site s)) q)) ↔ (∃ M : (S → W) →ₗ[ℝ] ℝ, ∀ q, DegreeLE (1 : Option K → ℕ) h q → affineModeLift L q = M (siteEvaluation (fun s (k : Option K) => k.elim 1 (site s)) q)) := exists_congr (fun M => affineModeLift_factorization_iff h site L M)
theorem exists_highest_affine_nonfactor {K S : Type*} {m : ℕ} {W : Fin m → Type*} [∀ j, AddCommGroup (W j)] [∀ j, Module ℝ (W j)] (site : S → K → ℝ) (L : ∀ j, VectorPolynomial K ℝ (W j) →ₗ[ℝ] ℝ) (hbad : ∃ i, ¬∃ M : (S → W i) →ₗ[ℝ] ℝ, ∀ q, Homogeneous (i.val + 1) q → affineModeLift (L i) q = M (siteEvaluation (fun s (k : Option K) => k.elim 1 (site s)) q)) : ∃ i, (¬∃ M : (S → W i) →ₗ[ℝ] ℝ, ∀ q, Homogeneous (i.val + 1) q → affineModeLift (L i) q = M (siteEvaluation (fun s (k : Option K) => k.elim 1 (site s)) q)) ∧ ∀ j, i < j → ∃ M : (S → W j) →ₗ[ℝ] ℝ, ∀ q, DegreeLE (1 : Option K → ℕ) (j.val + 1) q → affineModeLift (L j) q = M (siteEvaluation (fun s (k : Option K) => k.elim 1 (site s)) q) := by obtain ⟨i, hi, hh⟩ := exists_highest_exceptional_layer _ hbad refine ⟨i, hi, ?_⟩ intro j hj exact (affineModeLift_exists_factorization_iff (j.val + 1) site (L j)).mp (hh j hj)
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomial
open CircleFourieropen scoped BigOperators
theorem exists_absorbed_affine_site_tests {A I K S : Type*} {W : A → Type*} [Fintype A] [Fintype K] [Fintype S] [DecidableEq S] [∀ a, AddCommGroup (W a)] [∀ a, Module ℝ (W a)] (h : A → ℕ) (site : S → K → ℝ) (Λ : ∀ a, VectorPolynomial K ℝ (W a) →ₗ[ℝ] ℝ) (hfactor : ∀ a, ∃ M : (S → W a) →ₗ[ℝ] ℝ, ∀ q, Homogeneous (h a) q → affineModeLift (Λ a) q = M (siteEvaluation (fun s (i : Option K) => i.elim 1 (site s)) q)) (p : ∀ a, VectorPolynomial I ℝ (W a)) (hp : ∀ a, DegreeLE (1 : I → ℕ) (h a) (p a)) (low : (Option K → I → ℝ) → ℝ) (test : S → (I → ℝ) → ℂ) (htest : ∀ s x, ‖test s x‖ ≤ 1) : ∃ test' : S → (I → ℝ) → ℂ, (∀ s x, ‖test' s x‖ ≤ 1) ∧ ∀ b, character ((low b + ∑ a, MvPolynomial.eval (fun z => b z.1 z.2) (coefficientModePolynomial (affineModeLift (Λ a)) (p a)) : ℝ) : CircleFourier.Circle) * (∏ s, test s (fun i => b none i + ∑ k, b (some k) i * site s k)) = character (low b : CircleFourier.Circle) * (∏ s, test' s (fun i => b none i + ∑ k, b (some k) i * site s k)) := by obtain ⟨test', htest', he⟩ := exists_absorbed_polynomial_site_tests h site Λ hfactor p hp affineParameterSubstitution affineParameterSubstitution_degree low test htest refine ⟨test', htest', ?_⟩ intro b simpa only [coefficientModePolynomial_affine_eval, affineParameterSubstitution_eval] using he b
end Erdos3.VectorPolynomial
end
section
namespace Erdos3
open CircleFourier MvPolynomialopen scoped BigOperators Classical
def FiniteSitePhaseRemoval {h : ℕ} {S K X V : Type*} [Fintype S] [Fintype K] [Fintype X] [AddCommGroup V] (site : S → K → ℤ) (rows : Fin h → K → ℤ) : Prop := ∀ (base : K → V) (shift : X → V) (phase : (K → V) → ℝ) (test : S → V → ℂ), (∀ s v, ‖test s v‖ ≤ 1) → ‖𝔼 x, character (phase (rowShiftedTuple base rows shift x) : CircleFourier.Circle) * ∏ s, test s (integerSiteValue (site s) (rowShiftedTuple base rows shift x))‖ ^ (2 ^ h) ≤ ‖𝔼 u, 𝔼 v, character ((additiveBoxDifference h (fun x (_ : Unit) => phase (rowShiftedTuple base rows shift x)) u v () : ℝ) : CircleFourier.Circle)‖
theorem finiteSitePhaseRemoval_of_annihilates {h : ℕ} {S K X V : Type*} [Fintype S] [Fintype K] [Fintype X] [Nonempty X] [AddCommGroup V] (hh : 0 < h) (site : S → K → ℤ) (rows : Fin h → K → ℤ) (hzero : ∀ s, ∃ i, (∑ k, rows i k * site s k) = 0) : FiniteSitePhaseRemoval (X := X) (V := V) site rows := by intro base shift phase test htest exact row_shifted_site_phase_cauchySchwarz hh site base rows shift hzero phase test htest
namespace BooleanCubeKernel
theorem exists_vertex_mode_with_phase_removal {K J X V : Type*} [Fintype K] [Fintype J] [Fintype X] [Nonempty X] [AddCommGroup V] {q h : ℕ} (hh : 0 < h) (W : Submodule ℝ (J → ℝ)) (root : K → ℤ) (difference : Fin q → K → ℤ) (hlin : LinearIndependent ℝ (fun i k => (difference i k : ℝ))) {L C : ℝ} (hL : 0 ≤ L) (hC : 0 ≤ C) (hsite : ∀ (s : Finset (Fin q)) k, |((affineSite root difference s (some k) : ℤ) : ℝ)| ≤ L) (frequency : ((Option K) →₀ ℕ) → J → ℤ) (hbound : ∀ d, d.degree = h → ∀ j, |(frequency d j : ℝ)| ≤ C) (hnonfactor : ¬ ∃ M : (Finset (Fin q) → W) →ₗ[ℝ] ℝ, ∀ p, VectorPolynomial.Homogeneous h p → VectorPolynomial.coefficientFunctional (fun d j => (frequency d j : ℝ)) (VectorPolynomial.map W.subtype p) = M (VectorPolynomial.siteEvaluation (fun s => affineSite (fun k => (root k : ℝ)) (fun i k => (difference i k : ℝ)) s) p)) : ∃ rows : Fin h → Option K → ℤ, (∀ i k, |(rows i k : ℝ)| ≤ cubeModePolynomialBudget q L) ∧ (∀ s : Finset (Fin q), ∃ i, (∑ k, rows i k * affineSite root difference s k) = 0) ∧ (∀ j, |(VectorPolynomial.integerContractedRow frequency (∏ i, rowPolynomial (rows i)) j : ℝ)| ≤ C * cubeModePolynomialBudget q L ^ h) ∧ (∃ w : W, (∑ j, (VectorPolynomial.integerContractedRow frequency (∏ i, rowPolynomial (rows i)) j : ℝ) * w.val j) ≠ 0) ∧ FiniteSitePhaseRemoval (X := X) (V := V) (fun s => affineSite root difference s) rows := by obtain ⟨rows, hr, hz, hb, hw⟩ := exists_vertex_bounded_integer_mode W root difference hlin hL hC hsite frequency h hbound hnonfactor exact ⟨rows, hr, hz, hb, hw, finiteSitePhaseRemoval_of_annihilates hh _ rows hz⟩
end BooleanCubeKernelend Erdos3
end
section
namespace Erdos3.VectorPolynomial
theorem affineModeLift_comp_map {K V W : Type*} [AddCommGroup V] [Module ℝ V] [AddCommGroup W] [Module ℝ W] (f : V →ₗ[ℝ] W) (L : VectorPolynomial K ℝ W →ₗ[ℝ] ℝ) : affineModeLift (L.comp (map f)) = (affineModeLift L).comp (map f) := by apply LinearMap.ext intro q simp only [affineModeLift, LinearMap.comp_apply, map_substitute]
theorem exists_highest_affine_subspace_nonfactor {K S : Type*} {m : ℕ} {V : Fin m → Type*} [∀ j, AddCommGroup (V j)] [∀ j, Module ℝ (V j)] (U : ∀ j, Submodule ℝ (V j)) (site : S → K → ℝ) (L : ∀ j, VectorPolynomial K ℝ (V j) →ₗ[ℝ] ℝ) (hbad : ∃ i, ¬∃ M : (S → U i) →ₗ[ℝ] ℝ, ∀ q, Homogeneous (i.val + 1) q → affineModeLift (L i) (map (U i).subtype q) = M (siteEvaluation (fun s (k : Option K) => k.elim 1 (site s)) q)) : ∃ i, (¬∃ M : (S → U i) →ₗ[ℝ] ℝ, ∀ q, Homogeneous (i.val + 1) q → affineModeLift (L i) (map (U i).subtype q) = M (siteEvaluation (fun s (k : Option K) => k.elim 1 (site s)) q)) ∧ ∀ j, i < j → ∃ M : (S → U j) →ₗ[ℝ] ℝ, ∀ q, DegreeLE (1 : Option K → ℕ) (j.val + 1) q → affineModeLift (L j) (map (U j).subtype q) = M (siteEvaluation (fun s (k : Option K) => k.elim 1 (site s)) q) := by have hh := exists_highest_affine_nonfactor site (fun j => (L j).comp (map (U j).subtype)) (by simpa only [affineModeLift_comp_map, LinearMap.comp_apply] using hbad) simpa only [affineModeLift_comp_map, LinearMap.comp_apply] using hh
end Erdos3.VectorPolynomial
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120import OAI.Combinatorics.Progressions.Polynomial.AffineSidePolynomialBudget
namespace OAI
section
namespace Erdos3
theorem affineAdaptiveDegreeBudget_le_power {P : ℝ} (hP : 0 ≤ P) : affineAdaptiveDegreeBudget P ≤ 1024 * (P + 3) ^ 3 := by apply le_of_sub_nonneg simp only [affineAdaptiveDegreeBudget, affineLocalDegreeBudget, affineOuterDegreeInputBudget, affineLocalDegreeInputBudget, affineShellLogBudget, affineCountLogBudget, affinePrimitiveLogBudget] ring_nf positivity
theorem affineSidePolynomialBudget_le_power {P : ℝ} (hP : 0 ≤ P) : affineSidePolynomialBudget P ≤ 65536 * (P + 3) ^ 4 := by apply le_of_sub_nonneg simp only [affineSidePolynomialBudget, affineOrderPolynomialBudget, affineAccuracyPolynomialBudget, affineAdaptiveDegreeBudget, affineLocalDegreeBudget, affineOuterDegreeInputBudget, affineLocalDegreeInputBudget, affineShellLogBudget, affineCountLogBudget, affinePrimitiveLogBudget] ring_nf positivity
theorem adaptiveAffineCutoff_le_power (A sourceDim siteDim : ℕ) {epsilon L T C totalShell modLog P : ℝ} (hepsilon : 0 < epsilon) (hepsilon1 : epsilon ≤ 1) (hP : 0 ≤ P) (hL : 0 ≤ L) (hT : 0 ≤ T) (hC : 0 ≤ C) (hmod0 : 0 ≤ modLog) (hLP : L ≤ P) (hTP : T ≤ P) (hCP : C ≤ P) (hmod : modLog ≤ P) (hA : (A : ℝ) ≤ P) (hsource : (sourceDim : ℝ) ≤ P) (hsite : (siteDim : ℝ) ≤ P) (hinverse : epsilon⁻¹ ≤ Real.exp P) (htotal : 0 < totalShell) (htotalInv : totalShell⁻¹ ≤ Real.exp P) : (adaptiveAffineCutoff A sourceDim siteDim epsilon L T C totalShell modLog : ℝ) ≤ 1024 * (P + 3) ^ 3 := (adaptiveAffineCutoff_le_polynomialBudget A sourceDim siteDim hepsilon hepsilon1 hP hL hT hC hmod0 hLP hTP hCP hmod hA hsource hsite hinverse htotal htotalInv).trans (affineAdaptiveDegreeBudget_le_power hP)
theorem adaptiveAffineSideLog_le_power (A sourceDim siteDim : ℕ) {epsilon L T C totalShell modLog dimLog P : ℝ} (hepsilon : 0 < epsilon) (hepsilon1 : epsilon ≤ 1) (hP : 0 ≤ P) (hL : 0 ≤ L) (hT : 0 ≤ T) (hC : 0 ≤ C) (hmod0 : 0 ≤ modLog) (hLP : L ≤ P) (hTP : T ≤ P) (hCP : C ≤ P) (hmod : modLog ≤ P) (hdim : dimLog ≤ P) (hA : (A : ℝ) ≤ P) (hsource : (sourceDim : ℝ) ≤ P) (hsite : (siteDim : ℝ) ≤ P) (hinverse : epsilon⁻¹ ≤ Real.exp P) (htotal : 0 < totalShell) (htotalInv : totalShell⁻¹ ≤ Real.exp P) : adaptiveAffineSideLog A sourceDim siteDim epsilon L T C totalShell modLog dimLog ≤ 65536 * (P + 3) ^ 4 := (adaptiveAffineSideLog_le_polynomialBudget A sourceDim siteDim hepsilon hepsilon1 hP hL hT hC hmod0 hLP hTP hCP hmod hdim hA hsource hsite hinverse htotal htotalInv).trans (affineSidePolynomialBudget_le_power hP)
end Erdos3
end
section
namespace Erdos3
noncomputable def affineCommonReferenceBudget (E : ℕ) (epsilon U : ℝ) : ℝ := 2 * (affineReferenceInput epsilon U + 2) ^ E
theorem affineCommonReferenceBudget_bounds {E : ℕ} (hE : 2 ≤ E) (epsilon : ℝ) {U : ℝ} (hU : 0 ≤ U) : 0 ≤ affineCommonReferenceBudget E epsilon U ∧ U ≤ affineCommonReferenceBudget E epsilon U ∧ (⌈(affineReferenceInput epsilon U + 2) ^ E⌉₊ : ℝ) ≤ affineCommonReferenceBudget E epsilon U := by have hb := affineReferenceInput_bounds epsilon hU have hbase : 0 ≤ affineReferenceInput epsilon U + 2 := by linarith [hb.1] have hpow : affineReferenceInput epsilon U + 2 ≤ (affineReferenceInput epsilon U + 2) ^ E := by simpa only [pow_one] using pow_le_pow_right₀ (by linarith : 1 ≤ affineReferenceInput epsilon U + 2) (show 1 ≤ E by omega) have hc := Nat.ceil_lt_add_one (by positivity : 0 ≤ (affineReferenceInput epsilon U + 2) ^ E) unfold affineCommonReferenceBudget exact ⟨by positivity, by linarith [hb.2.1], by linarith [hb.1]⟩
theorem adaptiveAffineCutoff_reference_bounds {E sourceDim siteDim : ℕ} {epsilon L T C totalShell modLog U : ℝ} (hE : 2 ≤ E) (hepsilon : 0 < epsilon) (hepsilon1 : epsilon ≤ 1) (hU : 0 ≤ U) (hL : 0 ≤ L) (hT : 0 ≤ T) (hC : 0 ≤ C) (hmod0 : 0 ≤ modLog) (hLU : L ≤ U) (hTU : T ≤ U) (hCU : C ≤ U) (hmod : modLog ≤ U) (hsource : (sourceDim : ℝ) ≤ U) (hsite : (siteDim : ℝ) ≤ U) (hinverse : epsilon⁻¹ ≤ Real.exp U) (htotal : 0 < totalShell) (htotalInv : totalShell⁻¹ ≤ Real.exp U) : let A := ⌈(affineReferenceInput epsilon U + 2) ^ E⌉₊ let b := adaptiveAffineCutoff A sourceDim siteDim epsilon L T C totalShell modLog 2 * U ≤ (b : ℝ) ∧ (b : ℝ) ≤ 1024 * (affineCommonReferenceBudget E epsilon U + 3) ^ 3 := by intro A b have hp := affineReferenceInput_bounds epsilon hU have hc := affineCommonReferenceBudget_bounds hE epsilon hU have he : Real.exp U ≤ Real.exp (affineCommonReferenceBudget E epsilon U) := Real.exp_le_exp.mpr hc.2.1 constructor · have hA : A ≤ b := by have h := (adaptiveAffineCutoff_bounds A sourceDim siteDim epsilon L T C totalShell modLog).1 dsimp only [b] omega have hAr : (A : ℝ) ≤ b := by exact_mod_cast hA have hbase := ceil_power_dominates_twice hp.1 hE change 2 * affineReferenceInput epsilon U ≤ (A : ℝ) at hbase linarith [hp.2.1] · exact adaptiveAffineCutoff_le_power A sourceDim siteDim hepsilon hepsilon1 hc.1 hL hT hC hmod0 (hLU.trans hc.2.1) (hTU.trans hc.2.1) (hCU.trans hc.2.1) (hmod.trans hc.2.1) hc.2.2 (hsource.trans hc.2.1) (hsite.trans hc.2.1) (hinverse.trans he) htotal (htotalInv.trans he)
theorem adaptiveAffineSideLog_reference_bound {E sourceDim siteDim : ℕ} {epsilon L T C totalShell modLog dimLog U : ℝ} (hE : 2 ≤ E) (hepsilon : 0 < epsilon) (hepsilon1 : epsilon ≤ 1) (hU : 0 ≤ U) (hL : 0 ≤ L) (hT : 0 ≤ T) (hC : 0 ≤ C) (hmod0 : 0 ≤ modLog) (hLU : L ≤ U) (hTU : T ≤ U) (hCU : C ≤ U) (hmod : modLog ≤ U) (hdim : dimLog ≤ U) (hsource : (sourceDim : ℝ) ≤ U) (hsite : (siteDim : ℝ) ≤ U) (hinverse : epsilon⁻¹ ≤ Real.exp U) (htotal : 0 < totalShell) (htotalInv : totalShell⁻¹ ≤ Real.exp U) : adaptiveAffineSideLog ⌈(affineReferenceInput epsilon U + 2) ^ E⌉₊ sourceDim siteDim epsilon L T C totalShell modLog dimLog ≤ 65536 * (affineCommonReferenceBudget E epsilon U + 3) ^ 4 := by have hc := affineCommonReferenceBudget_bounds hE epsilon hU have he : Real.exp U ≤ Real.exp (affineCommonReferenceBudget E epsilon U) := Real.exp_le_exp.mpr hc.2.1 exact adaptiveAffineSideLog_le_power _ sourceDim siteDim hepsilon hepsilon1 hc.1 hL hT hC hmod0 (hLU.trans hc.2.1) (hTU.trans hc.2.1) (hCU.trans hc.2.1) (hmod.trans hc.2.1) (hdim.trans hc.2.1) hc.2.2 (hsource.trans hc.2.1) (hsite.trans hc.2.1) (hinverse.trans he) htotal (htotalInv.trans he)
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213import OAI.Combinatorics.Progressions.Probability.CanonicalCoverLawimport OAI.Combinatorics.Progressions.Probability.EuclideanJetDensityimport OAI.Combinatorics.Progressions.Probability.LowJetDensity
namespace OAI
section
namespace Erdos3.BooleanCubeKernel
open MeasureTheory VectorPolynomialopen scoped BigOperators Classical
theorem exists_affine_covered_density (m q : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ {K : Type*} [Fintype K] (root : K → ℤ) (difference : Fin q → K → ℤ) {P : ℝ}, 0 ≤ P → (Fintype.card K : ℝ) ≤ P → (∀ (s : Finset (Fin q)) k, |((affineSite root difference s (some k) : ℤ) : ℝ)| ≤ Real.exp P) → ∃ d : ℕ, 0 < d ∧ (d : ℝ) ≤ Real.exp ((P + A) ^ A) ∧ ∀ {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) [CompactSpace (CoefficientTorus (K := K) U)] [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] [MeasurableSpace (SiteTorus (Finset (Fin q)) U)] [BorelSpace (SiteTorus (Finset (Fin q)) U)] (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] (D : CoefficientTorus (K := K) U → ℝ), Continuous D → ∀ {B : ℝ}, (∀ x, D x ∈ Set.Icc (0 : ℝ) B) → (∫ x, D x ∂μ) = 1 → let E := coefficientSiteTorusMap U (fun s k => affineSite root difference s (some k)) let π := Set.rangeFactorization E let C := quotientIntegerCover (coefficientIntegerLattice U) d ∃ g : Set.range E → ℝ, Continuous g ∧ (∀ y, g y ∈ Set.Icc (0 : ℝ) B) ∧ Integrable g (μ.map π) ∧ (∫ y, g y ∂μ.map π) = 1 ∧ (realDensityMeasure μ (fun x => D (C x))).map π = realDensityMeasure (μ.map π) g ∧ ∀ {I F : Type*} [Fintype F] (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (c : F → ℂ) {η : ℝ}, (∀ x, ‖coefficientTorusFourierSum U frequency c x - (D x : ℂ)‖ ≤ η) → ∀ (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)), (∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) → ∀ (hm : ∀ j e, coefficients (p j) e ∈ U j) (b : Option K → I → ℝ), ‖affineCubeFourierProjection U root difference frequency p c b - (g (π (affineCoefficientCoverSample U p hm d b)) : ℂ)‖ ≤ η := by obtain ⟨A, hA, hbudget⟩ := exists_geometric_positive_cover_budget m q refine ⟨A, hA, ?_⟩ intro K _ root difference P hP hK hsite let site := fun s k => affineSite root difference s (some k) obtain ⟨d, T, hd, hT, hbound⟩ := exists_common_integer_site_residual (fun j : Fin m => boundedSiteMatrix (j.val + 1) site) (fun _ => exponentialSiteHeight m P) (fun _ => exponentialSiteHeight_pos m P) (fun j => boundedSiteMatrix_height_of_exp m (Nat.succ_le_of_lt j.isLt) site hsite) have hperiod := hbound (geometricSiteBudget_nonneg m q hP) (fun j => boundedCoefficientExponent_card_le_geometricSiteBudget m q (Nat.succ_le_of_lt j.isLt) hP hK) (cubeSites_card_le_geometricSiteBudget m q hP) (fun _ => (exponentialSiteHeight_le m hP).trans (Real.exp_le_exp.mpr (degree_mul_le_geometricSiteBudget m q hP))) refine ⟨d, hd, ?_, ?_⟩ · exact hperiod.trans (Real.exp_le_exp.mpr (by simpa only [Fintype.card_fin] using hbudget P hP)) intro J _ U _ _ _ _ _ μ _ _ D hD B hcap hmass E π C let R := coefficientSiteResidual U site (fun _ => d) T let hR := coefficientSiteResidual_preserves_lattice U site (fun _ => d) T obtain ⟨g, hgc, hgb, hgi, hgmass, hg, hlaw⟩ := exists_covered_coefficient_density U site d hd T (fun j x => hT j x) μ D hD hcap hmass refine ⟨g, hgc, hgb, hgi, hgmass, hlaw, ?_⟩ intro I F _ frequency c η happrox p hp hm b have hfactor (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) : (coefficientArrayFunctional U frequency).comp R = 0 ↔ affineCubeModeFactors U root difference frequency := by change (coefficientArrayFunctional U frequency).comp (coefficientSiteResidual U site (fun _ => d) T) = 0 ↔ _ rw [coefficientSiteResidual_zero_iff U site (fun _ => d) T (fun _ => hd) (fun j x => hT j x), affineCubeModeFactors_iff_bounded] have hb (x) : ‖D x‖ ≤ B := by rw [Real.norm_of_nonneg (hcap x).1]; exact (hcap x).2 have he := coefficientTorusFourierProjection_approx_residualAverage U R hR root difference hfactor frequency c μ D happrox (affineSampleCoefficientTorus U p hm b) (coefficientResidual_section_integrable U R hR μ D hD hb _) have hvalue := hg (affineCoefficientCoverSample U p hm d b) rw [affineCoefficientCoverSample_projection U p hm d hd b] at hvalue rw [hvalue] simpa only [coefficientTorusCharacter_sample U _ p hp hm b, affineCubeFourierProjection] using he
end Erdos3.BooleanCubeKernel
end
section
namespace Erdos3.BooleanCubeKernel
open MeasureTheory VectorPolynomialopen scoped Classical
theorem exists_affine_covered_euclidean_density (m q : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ {K : Type*} [Fintype K] (root : K → ℤ) (difference : Fin q → K → ℤ) {P : ℝ}, 0 ≤ P → (Fintype.card K : ℝ) ≤ P → (∀ (s : Finset (Fin q)) k, |((affineSite root difference s (some k) : ℤ) : ℝ)| ≤ Real.exp P) → ∃ d : ℕ, 0 < d ∧ (d : ℝ) ≤ Real.exp ((P + A) ^ A) ∧ ∀ (a : ℤ), a ≠ 0 → integerScalarLattice (Fin q) a ≤ (Matrix.of difference).mulVecLin.range → ∀ {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) [CompactSpace (CoefficientTorus (K := K) U)] [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] [MeasurableSpace (SiteTorus (Finset (Fin q)) U)] [BorelSpace (SiteTorus (Finset (Fin q)) U)] (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] (ν : ∀ j, Measure (euclideanSubspace (U j) ⧸ (latticeSection (standardEuclideanLattice (J j)) (euclideanSubspace (U j))).toAddSubgroup)) [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] (D : CoefficientTorus (K := K) U → ℝ), Continuous D → ∀ {B : ℝ}, (∀ x, D x ∈ Set.Icc (0 : ℝ) B) → (∫ x, D x ∂μ) = 1 → let F := euclideanCoefficientJetMap U root (Matrix.of difference) (fun j => (Subtype.val : BoundedBooleanJet (Fin q) (j.val + 1) → Finset (Fin q))) let C := quotientIntegerCover (coefficientIntegerLattice U) d let ξ := Measure.pi (fun j => Measure.pi (fun _ : BoundedBooleanJet (Fin q) (j.val + 1) => ν j)) ∃ f : EuclideanJetLayers U (fun j => BoundedBooleanJet (Fin q) (j.val + 1)) → ℝ, Continuous f ∧ (∀ z, f z ∈ Set.Icc (0 : ℝ) B) ∧ Integrable f ξ ∧ (∫ z, f z ∂ξ) = 1 ∧ (realDensityMeasure μ (fun x => D (C x))).map F = realDensityMeasure ξ f ∧ ∀ {I G : Type*} [Fintype G] (frequency : G → ∀ j, (K →₀ ℕ) → J j → ℤ) (c : G → ℂ) {η : ℝ}, (∀ x, ‖coefficientTorusFourierSum U frequency c x - (D x : ℂ)‖ ≤ η) → ∀ (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)), (∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) → ∀ (hm : ∀ j e, coefficients (p j) e ∈ U j) (b : Option K → I → ℝ), ‖affineCubeFourierProjection U root difference frequency p c b - (f (F (affineCoefficientCoverSample U p hm d b)) : ℂ)‖ ≤ η := by obtain ⟨A, hA, hcover⟩ := exists_affine_covered_density m q refine ⟨A, hA, ?_⟩ intro K _ root difference P hP hK hsite obtain ⟨d, hd, hdb, hcover⟩ := hcover root difference hP hK hsite refine ⟨d, hd, hdb, ?_⟩ intro a ha hperiod J _ U _ _ _ _ _ μ _ _ ν _ _ D hD B hcap hmass F C ξ obtain ⟨g, hgc, hgb, _, hgmass, hglaw, hgapprox⟩ := hcover U μ D hD hcap hmass obtain ⟨hfc, hfb, hfi, hfmass, hvalue, hflaw⟩ := siteImage_density_euclideanJet U root (Matrix.of difference) a ha hperiod μ ν (realDensityMeasure μ (fun x => D (C x))) g hgc hgb hgmass hglaw refine ⟨_, hfc, hfb, hfi, hfmass, hflaw, ?_⟩ intro I G _ frequency c η happrox p hp hm b have he := hvalue (Set.rangeFactorization (coefficientSiteTorusMap U (integerAffineCube root (Matrix.of difference))) (affineCoefficientCoverSample U p hm d b)) change (g ((euclideanSiteImageHomeomorph U root (Matrix.of difference) a ha hperiod).symm (F (affineCoefficientCoverSample U p hm d b)))) = _ at he rw [he] exact hgapprox frequency c happrox p hp hm b
end Erdos3.BooleanCubeKernel
end
section
namespace Erdos3.BooleanCubeKernel
open MeasureTheory VectorPolynomialopen scoped Classical
theorem exists_affine_covered_jet_density (m q : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ {K : Type*} [Fintype K] (root : K → ℤ) (difference : Fin q → K → ℤ) {P : ℝ}, 0 ≤ P → (Fintype.card K : ℝ) ≤ P → (∀ (s : Finset (Fin q)) k, |((affineSite root difference s (some k) : ℤ) : ℝ)| ≤ Real.exp P) → ∃ d : ℕ, 0 < d ∧ (d : ℝ) ≤ Real.exp ((P + A) ^ A) ∧ ∀ (a : ℤ), a ≠ 0 → integerScalarLattice (Fin q) a ≤ (Matrix.of difference).mulVecLin.range → ∀ {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) [CompactSpace (CoefficientTorus (K := K) U)] [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] [MeasurableSpace (SiteTorus (Finset (Fin q)) U)] [BorelSpace (SiteTorus (Finset (Fin q)) U)] [∀ j, MeasurableSpace (SubspaceArrayTorus (BoundedBooleanJet (Fin q) (j.val + 1)) (U j))] [∀ j, BorelSpace (SubspaceArrayTorus (BoundedBooleanJet (Fin q) (j.val + 1)) (U j))] (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] (ν : ∀ j, Measure (SubspaceArrayTorus (BoundedBooleanJet (Fin q) (j.val + 1)) (U j))) [∀ j, (ν j).IsAddLeftInvariant] [∀ j, IsProbabilityMeasure (ν j)] (D : CoefficientTorus (K := K) U → ℝ), Continuous D → ∀ {B : ℝ}, (∀ x, D x ∈ Set.Icc (0 : ℝ) B) → (∫ x, D x ∂μ) = 1 → let F := coefficientBooleanJetTorusMap U root (Matrix.of difference) (fun j => (Subtype.val : BoundedBooleanJet (Fin q) (j.val + 1) → Finset (Fin q))) let C := quotientIntegerCover (coefficientIntegerLattice U) d ∃ f : LowBooleanJetTorus (Fin q) U → ℝ, Continuous f ∧ (∀ z, f z ∈ Set.Icc (0 : ℝ) B) ∧ Integrable f (Measure.pi ν) ∧ (∫ z, f z ∂Measure.pi ν) = 1 ∧ (realDensityMeasure μ (fun x => D (C x))).map F = realDensityMeasure (Measure.pi ν) f ∧ ∀ {I G : Type*} [Fintype G] (frequency : G → ∀ j, (K →₀ ℕ) → J j → ℤ) (c : G → ℂ) {η : ℝ}, (∀ x, ‖coefficientTorusFourierSum U frequency c x - (D x : ℂ)‖ ≤ η) → ∀ (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)), (∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) → ∀ (hm : ∀ j e, coefficients (p j) e ∈ U j) (b : Option K → I → ℝ), ‖affineCubeFourierProjection U root difference frequency p c b - (f (F (affineCoefficientCoverSample U p hm d b)) : ℂ)‖ ≤ η := by obtain ⟨A, hA, hcover⟩ := exists_affine_covered_density m q refine ⟨A, hA, ?_⟩ intro K _ root difference P hP hK hsite obtain ⟨d, hd, hdb, hcover⟩ := hcover root difference hP hK hsite refine ⟨d, hd, hdb, ?_⟩ intro a ha hperiod J _ U _ _ _ _ _ _ _ μ _ _ ν _ _ D hD B hcap hmass F C obtain ⟨g, hgc, hgb, _, hgmass, hglaw, hgapprox⟩ := hcover U μ D hD hcap hmass obtain ⟨f, hfc, hfb, hfi, hfmass, hvalue, hflaw⟩ := siteImage_density_lowJet U root (Matrix.of difference) a ha hperiod μ ν (realDensityMeasure μ (fun x => D (C x))) g hgc hgb hgmass hglaw refine ⟨f, hfc, hfb, hfi, hfmass, hflaw, ?_⟩ intro I G _ frequency c η happrox p hp hm b have he := hvalue (Set.rangeFactorization (coefficientSiteTorusMap U (integerAffineCube root (Matrix.of difference))) (affineCoefficientCoverSample U p hm d b)) change f (F (affineCoefficientCoverSample U p hm d b)) = _ at he rw [he] exact hgapprox frequency c happrox p hp hm b
end Erdos3.BooleanCubeKernel
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899import OAI.Combinatorics.Progressions.Geometry.GeometricRetainedCommonCover
namespace OAI
section
namespace Erdos3.BooleanCubeKernel
open VectorPolynomialopen scoped BigOperators
noncomputable def affineCoveredSiteSample {I K : Type*} [Fintype K] {m q : ℕ} {J : Fin m → Type*} (U : ∀ j, Submodule ℝ (J j → ℝ)) (root : K → ℤ) (difference : Fin q → K → ℤ) (D : ℕ) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (hm : ∀ j d, coefficients (p j) d ∈ U j) (x : Option K → I → ℝ) : ∀ j, SubspaceArrayTorus (Finset (Fin q)) (U j) := fun j => QuotientAddGroup.mk' (subspaceArrayIntegerLattice (Finset (Fin q)) (U j)) ((D : ℝ)⁻¹ • VectorPolynomial.siteEvaluation (fun s k => ((affineSite root difference s (some k) : ℤ) : ℝ)) (substitute (affineParameterSubstitution x) (restrictCoefficients (U j) (p j) (hm j))))
theorem layeredCoefficientCharacter_of_site_factorization {I K : Type*} [Fintype K] {m q : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) (root : K → ℤ) (difference : Fin q → K → ℤ) (D : ℕ) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) (b : ∀ j, Matrix (Finset (Fin q)) (J j) ℤ) (hchar : ∀ (j : Fin m) (v : VectorPolynomial K ℝ (U j)), DegreeLE (1 : K → ℕ) (j.val + 1) v → CircleFourier.character (coefficientFunctional (fun d a => (frequency j d a : ℝ)) (map (U j).subtype v) : CircleFourier.Circle) = subspaceArrayCharacter (U j) (b j) (QuotientAddGroup.mk' (subspaceArrayIntegerLattice (Finset (Fin q)) (U j)) ((D : ℝ)⁻¹ • VectorPolynomial.siteEvaluation (fun s k => ((affineSite root difference s (some k) : ℤ) : ℝ)) v))) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (hm : ∀ j d, coefficients (p j) d ∈ U j) (x : Option K → I → ℝ) : layeredCoefficientCharacter (fun j => affineModeLift (coefficientFunctional (fun d a => (frequency j d a : ℝ)))) p x = ∏ j, subspaceArrayCharacter (U j) (b j) (affineCoveredSiteSample U root difference D p hm x j) := by unfold layeredCoefficientCharacter rw [character_real_sum] apply Finset.prod_congr rfl intro j _ rw [affineModeLift_substitute] have he := hchar j (substitute (affineParameterSubstitution x) (restrictCoefficients (U j) (p j) (hm j))) (degreeLE_substitute_affine _ (affineParameterSubstitution_degree x) _ (degreeLE_restrictCoefficients (U j) (p j) (hm j) (hp j))) simpa only [map_substitute, map_restrictCoefficients, affineCoveredSiteSample] using he
end Erdos3.BooleanCubeKernel
end
section
namespace Erdos3.BooleanCubeKernel
open VectorPolynomialopen scoped BigOperators
theorem affine_site_substitution_eval {I K W : Type*} [Fintype K] [AddCommGroup W] [Module ℝ W] {q : ℕ} (root : K → ℤ) (difference : Fin q → K → ℤ) (p : VectorPolynomial I ℝ W) (x : Option K → I → ℝ) : VectorPolynomial.siteEvaluation (fun s k => ((affineSite root difference s (some k) : ℤ) : ℝ)) (substitute (affineParameterSubstitution x) p) = fun s => eval (integerSiteValue (affineSite root difference s) x) p := by funext s change eval _ (substitute _ p) = _ rw [eval_substitute] apply congrArg (fun t : I → ℝ => eval t p) funext i rw [affineParameterSubstitution_eval] simp [integerSiteValue, Fintype.sum_option, affineSite, Finset.sum_apply, zsmul_eq_mul, mul_comm]
theorem affineCoveredSiteSample_eq_values {I K : Type*} [Fintype K] {m q : ℕ} {J : Fin m → Type*} (U : ∀ j, Submodule ℝ (J j → ℝ)) (root : K → ℤ) (difference : Fin q → K → ℤ) (D : ℕ) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (hm : ∀ j d, coefficients (p j) d ∈ U j) (x : Option K → I → ℝ) (j : Fin m) : affineCoveredSiteSample U root difference D p hm x j = QuotientAddGroup.mk' (subspaceArrayIntegerLattice (Finset (Fin q)) (U j)) ((D : ℝ)⁻¹ • fun s => eval (integerSiteValue (affineSite root difference s) x) (restrictCoefficients (U j) (p j) (hm j))) := by unfold affineCoveredSiteSample rw [affine_site_substitution_eval]
end Erdos3.BooleanCubeKernel
end
end OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546import OAI.Combinatorics.Progressions.Estimates.CoefficientSliceEmbedding
namespace OAI
section
namespace Erdos3
def affineCubeCoordinates {I : Type*} (u : Option I → ℝ) (v : Option I → ℕ) (x : Option I → ℝ) : Option I → ℝ := fun i => u i + (v i : ℝ) * x i
def affineIntegerCubeCoordinates {I : Type*} (u : Option I → ℤ) (v : Option I → ℕ) (x : Option I → ℤ) : Option I → ℤ := fun i => u i + (v i : ℤ) * x i
theorem affineIntegerCubeCoordinates_cast {I : Type*} (u : Option I → ℤ) (v : Option I → ℕ) (x : Option I → ℤ) : (fun i => (affineIntegerCubeCoordinates u v x i : ℝ)) = affineCubeCoordinates (fun i => (u i : ℝ)) v (fun i => (x i : ℝ)) := by funext i simp only [affineIntegerCubeCoordinates, affineCubeCoordinates, Int.cast_add, Int.cast_mul, Int.cast_natCast]
theorem ScalarCubeLocalizationData.affine_point_scale {I : Type*} [Fintype I] [DecidableEq I] (d : ScalarCubeLocalizationData I) (u : Option I → ℝ) (v : Option I → ℕ) (z : IntegerScalarCubeBox I d.length) : affineCubeCoordinates u v (fun i => (d.length : ℝ) * d.point z i) = affineCubeCoordinates u v (fun i => (z i : ℝ)) := by congr 1 funext i exact d.point_scale z i
theorem ScalarCubeLocalizationData.affine_cell_scale {I : Type*} [Fintype I] [DecidableEq I] (d : ScalarCubeLocalizationData I) (u : Option I → ℝ) (v : Option I → ℕ) (k : Option I → Fin d.cellCount) (t : Option I → Fin d.cellLength) : affineCubeCoordinates u v (fun i => (d.length : ℝ) * d.cell k t i) = fun i => (u i + (v i : ℝ) * d.integerOffset k i) + ((v i * d.modulus i : ℕ) : ℝ) * (t i).val := by rw [d.cell_scale] funext i simp only [affineCubeCoordinates, Nat.cast_mul] ring
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384import OAI.Combinatorics.Progressions.Fourier.SectionRetainedFourier
namespace OAI
section
namespace Erdos3.BooleanCubeKernel
open VectorPolynomial Polynomialopen scoped BigOperators
theorem exists_affine_cube_covered_projection (m q : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {J : Fin m → Type*} [∀ j, Fintype (J j)] {F : Type*} [Fintype F] {P : ℝ} (_hP : 0 ≤ P) (_hn : (Fintype.card I : ℝ) ≤ P) (_hK : (Fintype.card K : ℝ) ≤ P) (_hd : (Fintype.card (Option K × I) : ℝ) ≤ P) (U : ∀ j, Submodule ℝ (J j → ℝ)) (root : K → ℤ) (difference : Fin q → K → ℤ) (_hlin : LinearIndependent ℝ (fun i k => (difference i k : ℝ))) {L C : ℝ} (_hL : 0 ≤ L) (_hC : 0 ≤ C) (_hLP : L ≤ Real.exp P) (_hCP : C ≤ Real.exp P) (_hsite : ∀ (s : Finset (Fin q)) k, |((affineSite root difference s (some k) : ℤ) : ℝ)| ≤ L) (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (_hbound : ∀ a j d, d.degree ≤ j.val + 1 → ∀ t, |(frequency a j d t : ℝ)| ≤ C) (c : F → ℂ) {B : ℝ} (_hB : 0 ≤ B) (_hBP : B ≤ Real.exp P) (_hcoefficients : (∑ a, ‖c a‖) ≤ B) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (_hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (hm : ∀ j d, coefficients (p j) d ∈ U j) (stride : I → ℕ) (_hs : ∀ k, 0 < stride k) {R S ρ ε : ℝ} (_hS : 0 ≤ S) (_hSP : S ≤ Real.exp P) (_hρ : 0 < ρ) (_hε : 0 < ε) (_hρP : 1 / ρ ≤ Real.exp P) (_hεP : 1 / ε ≤ Real.exp P) (_hstride : ∀ k, (stride k : ℝ) ≤ S) (H : I → ℝ) (_hsize : ∀ k, Real.exp ((P + A) ^ A) ≤ H k) (_hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (_hR : Real.exp ((P + A) ^ A) ≤ R) (Q : MvPolynomial (Option K × I) ℝ) (_hQ : Q.totalDegree ≤ 0) (test : Finset (Fin q) → (I → ℝ) → ℂ) (_htest : ∀ t v, ‖test t v‖ ≤ 1) (G : Finset (ColumnResiduePattern (Option K) I stride)) (_hG : G.Nonempty) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (_hwidth : ∀ z, ρ * H z.2 ≤ V z), ∃ D : ℕ, 0 < D ∧ (D : ℝ) ≤ Real.exp ((P + A) ^ A) ∧ ∃ b : F → ∀ j, Matrix (Finset (Fin q)) (J j) ℤ, (∀ a j s t, |(b a j s t : ℝ)| ≤ Real.exp ((P + A) ^ A)) ∧ ∃ hZ : 0 < ∑' x, selectedResidueSmoothWeight stride G V x, ‖(∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * (layeredSiteWeight Q (fun s => affineSite root difference s) test (fun k j => (z (k, j) : ℝ)) * affineCubeFourierSum frequency p c (fun k j => (z (k, j) : ℝ)))) - (∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * (layeredSiteWeight Q (fun s => affineSite root difference s) test (fun k j => (z (k, j) : ℝ)) * retainedSiteFourierSum U root difference frequency b c (affineCoveredSiteSample U root difference D p hm (fun k j => (z (k, j) : ℝ)))))‖ ≤ ε := by obtain ⟨A₀, _, hprojection⟩ := exists_affine_cube_fourier_projection m q obtain ⟨A₁, _, hcover⟩ := exists_geometric_site_fourier_projection m q obtain ⟨A, hA, hbudget⟩ := exists_natPolynomial_eval_budget ((X + Polynomial.C A₀) ^ A₀ + (X + Polynomial.C A₁) ^ A₁) refine ⟨A, hA, ?_⟩ intro I K _ _ _ J _ F _ P hP hn hK hd U root difference hlin L C hL hC hLP hCP hsite frequency hbound c B hB hBP hcoefficients p hp hm stride hs R S ρ ε hS hSP hρ hε hρP hεP hstride H hsize hrank hR Q hQ test htest G hG V hV hwidth have hsum : (P + A₀) ^ A₀ + (P + A₁) ^ A₁ ≤ (P + A) ^ A := by simpa [Polynomial.eval₂_pow] using hbudget P hP have hb₀ : (P + A₀) ^ A₀ ≤ (P + A) ^ A := by linarith [pow_nonneg (add_nonneg hP (Nat.cast_nonneg A₁)) A₁] have hb₁ : (P + A₁) ^ A₁ ≤ (P + A) ^ A := by linarith [pow_nonneg (add_nonneg hP (Nat.cast_nonneg A₀)) A₀] obtain ⟨D, hD, hDP, hrows⟩ := hcover root difference hP hK (fun s k => (hsite s k).trans hLP) obtain ⟨b, hb, heq⟩ := hrows U frequency (fun a j d hd t => (hbound a j d hd t).trans hCP) obtain ⟨hZ, hproj⟩ := hprojection hP hn hd U root difference hlin hL hC hLP hCP hsite frequency hbound c hB hBP hcoefficients p hp hm stride hs hS hSP hρ hε hρP hεP hstride H (fun k => (Real.exp_le_exp.mpr hb₀).trans (hsize k)) hrank ((Real.exp_le_exp.mpr hb₀).trans hR) Q hQ test htest G hG V hV hwidth refine ⟨D, hD, hDP.trans (Real.exp_le_exp.mpr hb₁), b, fun a j s t => (hb a j s t).trans (Real.exp_le_exp.mpr hb₁), hZ, ?_⟩ have hfun : affineCubeFourierProjection U root difference frequency p c = fun x => retainedSiteFourierSum U root difference frequency b c (affineCoveredSiteSample U root difference D p hm x) := funext (fun x => heq p hp hm c x) rw [hfun] at hproj exact hproj
end Erdos3.BooleanCubeKernel
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622import Mathlib.MeasureTheory.Measure.Lebesgue.EqHaarimport OAI.Combinatorics.Progressions.Estimates.CanonicalCubeMinorThresholdimport OAI.Combinatorics.Progressions.Probability.JointBooleanCutoffLaw
namespace OAI
section
namespace Erdos3
open MeasureTheory
variable {I : Type*} [Fintype I]
theorem affine_preimage_volume_real (L : (I → ℝ) ≃L[ℝ] (I → ℝ)) (b : I → ℝ) (s : Set (I → ℝ)) : volume.real ((fun x => b + L x) ⁻¹' s) = inverseJacobian L * volume.real s := by change (volume (L ⁻¹' ((fun x => b + x) ⁻¹' s))).toReal = _ rw [Measure.addHaar_preimage_continuousLinearEquiv volume L, measure_preimage_add, ENNReal.toReal_mul, ENNReal.toReal_ofReal (abs_nonneg _)] rfl
theorem affine_sublevel_volume_real (L : (I → ℝ) ≃L[ℝ] (I → ℝ)) (b : I → ℝ) (Ω : Set (I → ℝ)) (g : (I → ℝ) → ℝ) (u : ℝ) : volume.real (Ω ∩ {x | |g (b + L x)| ≤ u}) = inverseJacobian L * volume.real (((fun x => b + L x) '' Ω) ∩ {x | |g x| ≤ u}) := by have he : Ω ∩ {x | |g (b + L x)| ≤ u} = (fun x => b + L x) ⁻¹' (((fun x => b + L x) '' Ω) ∩ {x | |g x| ≤ u}) := by ext x constructor · rintro ⟨hx, hg⟩ exact ⟨⟨x, hx, rfl⟩, hg⟩ · rintro ⟨⟨y, hy, he⟩, hg⟩ have hyx : y = x := L.injective (add_left_cancel he) exact ⟨hyx ▸ hy, hg⟩ rw [he, affine_preimage_volume_real]
theorem exists_affine_boolean_minor_sublevel_bound {O α : Type*} [Fintype O] [Fintype α] [DecidableEq O] [DecidableEq α] (c : O → ℝ) (sets : O → Finset α) (hsets : Function.Injective sets) (h : ℕ) (hh : 0 < h) (hcard : ∀ o, (sets o).card ≤ h) {N : ℕ} (e : BlockParameter O (Fin h) α ≃ Fin N) (hN : 0 < N) {c₀ : ℝ} (hc₀ : 0 < c₀) (hc : ∀ o, c₀ ≤ |c o|) : ∃ r : O → Option α, ∀ (d : ℕ), 0 < d → Fintype.card O * (h - 1) ≤ d → ∀ (L : (Fin N → ℝ) ≃L[ℝ] (Fin N → ℝ)) (b : Fin N → ℝ) (Ω : Set (Fin N → ℝ)) (R u : ℝ), 1 ≤ R → (∀ x ∈ Ω, ∀ j, |(b + L x) j| ≤ R) → 0 < u → volume.real (Ω ∩ {x | |((booleanSelectedMinor c sets id (⟨0, hh⟩ : Fin h) r).map (MvPolynomial.eval ((b + L x) ∘ e))).det| ≤ u}) ≤ inverseJacobian L * (R ^ N * multivariateSublevelConstant N d * (u * (d + 1 : ℝ) ^ N / c₀ ^ Fintype.card O) ^ (((N * d : ℕ) : ℝ)⁻¹)) := by obtain ⟨r, hr⟩ := exists_boolean_minor_sublevel_bound c sets hsets h hh hcard e hN hc₀ hc refine ⟨r, ?_⟩ intro d hd hdeg L b Ω R u hR hΩ hu rw [affine_sublevel_volume_real L b Ω (fun x => ((booleanSelectedMinor c sets id (⟨0, hh⟩ : Fin h) r).map (MvPolynomial.eval (x ∘ e))).det) u] apply mul_le_mul_of_nonneg_left _ (inverseJacobian_pos L).le apply hr d hd hdeg _ R u hR _ hu rintro y ⟨x, hx, rfl⟩ j exact hΩ x hx j
end Erdos3
end
section
namespace Erdos3
open MeasureTheory
noncomputable def reindexedAffineSource {I : Type*} {N : ℕ} (e : I ≃ Fin N) (L : (Fin N → ℝ) ≃L[ℝ] (Fin N → ℝ)) (b : Fin N → ℝ) (a : I → ℝ) : I → ℝ := (b + L (a ∘ e.symm)) ∘ e
theorem reindexedAffineSource_continuous {I : Type*} [Fintype I] {N : ℕ} (e : I ≃ Fin N) (L : (Fin N → ℝ) ≃L[ℝ] (Fin N → ℝ)) (b : Fin N → ℝ) : Continuous (reindexedAffineSource e L b) := by unfold reindexedAffineSource fun_prop
theorem reindexedAffineSource_apply {I : Type*} {N : ℕ} (e : I ≃ Fin N) (L : (Fin N → ℝ) ≃L[ℝ] (Fin N → ℝ)) (b x : Fin N → ℝ) : reindexedAffineSource e L b (x ∘ e) = (b + L x) ∘ e := by have he : (x ∘ e) ∘ e.symm = x := by funext j; simp simp only [reindexedAffineSource, he]
theorem exists_affine_cube_minor_probability_bound {O α : Type*} [Fintype O] [Fintype α] [DecidableEq O] [DecidableEq α] (c : O → ℝ) (sets : O → Finset α) (hsets : Function.Injective sets) (h : ℕ) (hh : 0 < h) (hcard : ∀ o, (sets o).card ≤ h) {N : ℕ} (e : BlockParameter O (Fin h) α ≃ Fin N) (hN : 0 < N) {c₀ : ℝ} (hc₀ : 0 < c₀) (hc : ∀ o, c₀ ≤ |c o|) : ∃ r : O → Option α, ∀ d : ℕ, 0 < d → Fintype.card O * (h - 1) ≤ d → ∀ (L : (Fin N → ℝ) ≃L[ℝ] (Fin N → ℝ)) (b : Fin N → ℝ) (R u : ℝ), 1 ≤ R → (∀ x ∈ reindexedBlockCubeDomain e, ∀ j, |(b + L x) j| ≤ R) → 0 < u → (blockCubeMeasure O (Fin h) α).real {a | |booleanMinorDeterminant c sets id (⟨0, hh⟩ : Fin h) r (reindexedAffineSource e L b a)| ≤ u} ≤ scalarCubeDomainDensity α ^ Fintype.card (O × Fin h) * inverseJacobian L * (R ^ N * multivariateSublevelConstant N d * (u * (d + 1 : ℝ) ^ N / c₀ ^ Fintype.card O) ^ (((N * d : ℕ) : ℝ)⁻¹)) := by obtain ⟨r, hr⟩ := exists_affine_boolean_minor_sublevel_bound c sets hsets h hh hcard e hN hc₀ hc refine ⟨r, ?_⟩ intro d hd hdeg L b R u hR hbox hu have hsm : MeasurableSet {a | |booleanMinorDeterminant c sets id (⟨0, hh⟩ : Fin h) r (reindexedAffineSource e L b a)| ≤ u} := measurableSet_le (((booleanMinorDeterminant_contDiff c sets id (⟨0, hh⟩ : Fin h) r).continuous.comp (reindexedAffineSource_continuous e L b)).measurable.abs) measurable_const rw [blockCubeMeasure_real_reindex e _ hsm] simp only [Set.mem_ofPred_eq, reindexedAffineSource_apply] have hvol := hr d hd hdeg L b (reindexedBlockCubeDomain e) R u hR hbox hu exact (mul_le_mul_of_nonneg_left hvol (pow_nonneg (scalarCubeDomainDensity_pos α).le (Fintype.card (O × Fin h)))).trans_eq (mul_assoc _ _ _).symm
theorem booleanMinorDeterminant_affine_sublevel_marginal {B O F α : Type*} [Fintype B] [Fintype O] [Fintype F] [Fintype α] [DecidableEq B] [DecidableEq O] [DecidableEq F] [DecidableEq α] (c : B → ℝ) (sets : O → Finset α) (block : O → B) (hblock : Function.Injective block) (v : F) (r : O → Option α) (T : (BlockParameter B F α → ℝ) → (BlockParameter B F α → ℝ)) (T₀ : (BlockParameter O F α → ℝ) → (BlockParameter O F α → ℝ)) (hT₀ : Measurable T₀) (hrestrict : ∀ a, restrictBlockParameters block (T a) = T₀ (restrictBlockParameters block a)) (u : ℝ) : (blockCubeMeasure B F α).real {a | |booleanMinorDeterminant c sets block v r (T a)| ≤ u} = (blockCubeMeasure O F α).real {a | |booleanMinorDeterminant (c ∘ block) sets id v r (T₀ a)| ≤ u} := by have hs : MeasurableSet {a | |booleanMinorDeterminant (c ∘ block) sets id v r (T₀ a)| ≤ u} := measurableSet_le (((booleanMinorDeterminant_contDiff (c ∘ block) sets id v r).continuous.measurable.comp hT₀).abs) measurable_const have hm := (restrictBlockParameters_cube_measurePreserving (F := F) (α := α) block hblock).measureReal_preimage hs.nullMeasurableSet have he : {a | |booleanMinorDeterminant c sets block v r (T a)| ≤ u} = restrictBlockParameters block ⁻¹' {a | |booleanMinorDeterminant (c ∘ block) sets id v r (T₀ a)| ≤ u} := by ext a change |booleanMinorDeterminant c sets block v r (T a)| ≤ u ↔ _ rw [booleanMinorDeterminant_restrict c sets block v r (T a), hrestrict] rfl rw [he] exact hm
end Erdos3
end
section
namespace Erdos3
open MeasureTheoryopen scoped BigOperators
theorem inverseJacobian_coordinateScale_le {I : Type*} [Fintype I] (a : I → ℝ) (ha : ∀ i, a i ≠ 0) {δ : ℝ} (hδ : 0 < δ) (hwidth : ∀ i, δ ≤ |a i|) : inverseJacobian (coordinateScaleEquiv a ha).toContinuousLinearEquiv ≤ δ⁻¹ ^ Fintype.card I := by rw [inverseJacobian_eq] change |LinearMap.det (coordinateScaleEquiv a ha).toLinearMap|⁻¹ ≤ _ rw [diagonalDensityTransport_det, Finset.abs_prod, ← Finset.prod_inv_distrib] calc _ ≤ ∏ _i : I, δ⁻¹ := by apply Finset.prod_le_prod₀ · intro i _ exact inv_nonneg.mpr (abs_nonneg _) · intro i _ simpa only [one_div] using one_div_le_one_div_of_le hδ (hwidth i) _ = _ := by simp
theorem exists_allocated_affine_cube_minor_probability_bound {B O α : Type*} [Fintype B] [Fintype O] [Fintype α] [DecidableEq B] [DecidableEq O] [DecidableEq α] (c : B → ℝ) (sets : O → Finset α) (hsets : Function.Injective sets) (h : ℕ) (hh : 0 < h) (hcard : ∀ o, (sets o).card ≤ h) (block : O → B) (hblock : Function.Injective block) {N : ℕ} (e : BlockParameter O (Fin h) α ≃ Fin N) (hN : 0 < N) {c₀ : ℝ} (hc₀ : 0 < c₀) (hc : ∀ o, c₀ ≤ |c (block o)|) : ∃ r : O → Option α, ∀ d : ℕ, 0 < d → Fintype.card O * (h - 1) ≤ d → ∀ (center width : BlockParameter B (Fin h) α → ℝ) (δ u : ℝ), 0 < δ → (∀ z : BlockParameter O (Fin h) α, δ ≤ |restrictBlockParameters block width z|) → (∀ z : BlockParameter O (Fin h) α, |restrictBlockParameters block center z| + |restrictBlockParameters block width z| ≤ 1) → 0 < u → (blockCubeMeasure B (Fin h) α).real {a | |booleanMinorDeterminant c sets block (⟨0, hh⟩ : Fin h) r (fun z => center z + width z * a z)| ≤ u} ≤ scalarCubeDomainDensity α ^ Fintype.card (O × Fin h) * δ⁻¹ ^ N * (multivariateSublevelConstant N d * (u * (d + 1 : ℝ) ^ N / c₀ ^ Fintype.card O) ^ (((N * d : ℕ) : ℝ)⁻¹)) := by obtain ⟨r, hr⟩ := exists_affine_cube_minor_probability_bound (c ∘ block) sets hsets h hh hcard e hN hc₀ hc refine ⟨r, ?_⟩ intro d hd hdeg center width δ u hδ hwidth hbox hu let w : Fin N → ℝ := restrictBlockParameters block width ∘ e.symm let b : Fin N → ℝ := restrictBlockParameters block center ∘ e.symm have hw (i) : δ ≤ |w i| := hwidth (e.symm i) have hwne (i) : w i ≠ 0 := abs_pos.mp (hδ.trans_le (hw i)) let L := (coordinateScaleEquiv w hwne).toContinuousLinearEquiv let T := fun a : BlockParameter B (Fin h) α → ℝ => fun z => center z + width z * a z let T₀ := reindexedAffineSource e L b have hrestrict (a) : restrictBlockParameters block (T a) = T₀ (restrictBlockParameters block a) := by funext z change center (block z.1, z.2) + width (block z.1, z.2) * a (block z.1, z.2) = b (e z) + w (e z) * restrictBlockParameters block a (e.symm (e z)) simp only [w, b, Function.comp_apply, e.symm_apply_apply, restrictBlockParameters] rw [booleanMinorDeterminant_affine_sublevel_marginal c sets block hblock (⟨0, hh⟩ : Fin h) r T T₀ (reindexedAffineSource_continuous e L b).measurable hrestrict u] have hbox' (x) (hx : x ∈ reindexedBlockCubeDomain e) (i) : |(b + L x) i| ≤ (1 : ℝ) := by change |b i + w i * x i| ≤ 1 calc _ ≤ |b i| + |w i * x i| := abs_add_le _ _ _ = |b i| + |w i| * |x i| := by rw [abs_mul] _ ≤ |b i| + |w i| := add_le_add le_rfl (mul_le_of_le_one_right (abs_nonneg _) (reindexedBlockCubeDomain_box e hx i)) _ ≤ 1 := hbox (e.symm i) have hp := hr d hd hdeg L b 1 u le_rfl hbox' hu simp only [one_pow, one_mul] at hp apply hp.trans have hJ : inverseJacobian L ≤ δ⁻¹ ^ N := by simpa only [Fintype.card_fin] using inverseJacobian_coordinateScale_le w hwne hδ hw have hconst : 0 ≤ multivariateSublevelConstant N d := (multivariateSublevelConstant_pos hN d).le exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hJ (pow_nonneg (scalarCubeDomainDensity_pos α).le _)) (mul_nonneg hconst (Real.rpow_nonneg (by positivity) _))
end Erdos3
end
section
namespace Erdos3
open MeasureTheoryopen scoped BigOperators
noncomputable def affineCubeMinorThreshold (J O α : Type*) [Fintype J] [Fintype O] [Fintype α] [DecidableEq α] (h N d : ℕ) (c₀ δ η : ℝ) : ℝ := polynomialSublevelThreshold (N * d) (Fintype.card J) (cubeMinorProbabilityConstant O α h N d * δ⁻¹ ^ N) (cubeMinorProbabilityScale O N d c₀) η
theorem affineCubeMinorThreshold_pos (J O α : Type*) [Fintype J] [Fintype O] [Fintype α] [DecidableEq α] (h : ℕ) {N : ℕ} (hN : 0 < N) (d : ℕ) {c₀ δ η : ℝ} (hc₀ : 0 < c₀) (hδ : 0 < δ) (hη : 0 < η) : 0 < affineCubeMinorThreshold J O α h N d c₀ δ η := polynomialSublevelThreshold_pos _ _ (mul_nonneg (cubeMinorProbabilityConstant_pos O α h hN d).le (pow_nonneg (inv_nonneg.mpr hδ.le) _)) (cubeMinorProbabilityScale_pos O N d hc₀).le hη
theorem affineCubeMinorThreshold_log_inv (J O α : Type*) [Fintype J] [Fintype O] [Fintype α] [DecidableEq α] (h : ℕ) {N : ℕ} (hN : 0 < N) (d : ℕ) {c₀ δ η : ℝ} (hc₀ : 0 < c₀) (hδ : 0 < δ) (hη : 0 < η) : Real.log (affineCubeMinorThreshold J O α h N d c₀ δ η)⁻¹ = Real.log 2 + Real.log (1 + cubeMinorProbabilityScale O N d c₀) + (N * d : ℕ) * Real.log (1 + 2 * (cubeMinorProbabilityConstant O α h N d * δ⁻¹ ^ N) * (Fintype.card J + 1 : ℝ) / η) := polynomialSublevelThreshold_log_inv _ _ (mul_nonneg (cubeMinorProbabilityConstant_pos O α h hN d).le (pow_nonneg (inv_nonneg.mpr hδ.le) _)) (cubeMinorProbabilityScale_pos O N d hc₀).le hη
theorem exists_affine_cube_minor_thresholds {B O J α : Type*} [Fintype B] [Fintype O] [Fintype J] [Fintype α] [DecidableEq B] [DecidableEq O] [DecidableEq α] (c : J → B → ℝ) (sets : O → Finset α) (hsets : Function.Injective sets) (h : ℕ) (hh : 0 < h) (hcard : ∀ o, (sets o).card ≤ h) (block : J → O → B) (hblock : ∀ j, Function.Injective (block j)) {N : ℕ} (e : BlockParameter O (Fin h) α ≃ Fin N) (hN : 0 < N) (d : ℕ) (hd : 0 < d) (hdeg : Fintype.card O * (h - 1) ≤ d) {c₀ : ℝ} (hc₀ : 0 < c₀) (hc : ∀ j o, c₀ ≤ |c j (block j o)|) : ∃ sel : J → O → Option α, ∀ δ η : ℝ, 0 < δ → 0 < η → ∀ center width : BlockParameter B (Fin h) α → ℝ, (∀ j z, δ ≤ |restrictBlockParameters (block j) width z|) → (∀ j z, |restrictBlockParameters (block j) center z| + |restrictBlockParameters (block j) width z| ≤ 1) → (∑ j, (blockCubeMeasure B (Fin h) α).real {a | |booleanMinorDeterminant (c j) sets (block j) (⟨0, hh⟩ : Fin h) (sel j) (fun z => center z + width z * a z)| < 2 * affineCubeMinorThreshold J O α h N d c₀ δ η}) ≤ η / 2 := by choose sel hsel using (fun j => exists_allocated_affine_cube_minor_probability_bound (c j) sets hsets h hh hcard (block j) (hblock j) e hN hc₀ (hc j)) refine ⟨sel, ?_⟩ intro δ η hδ hη center width hwidth hbox let K := cubeMinorProbabilityConstant O α h N d * δ⁻¹ ^ N let scale := cubeMinorProbabilityScale O N d c₀ let κ := affineCubeMinorThreshold J O α h N d c₀ δ η have hK : 0 < K := mul_pos (cubeMinorProbabilityConstant_pos O α h hN d) (pow_pos (inv_pos.mpr hδ) _) have hscale : 0 < scale := cubeMinorProbabilityScale_pos O N d hc₀ have hκ : 0 < κ := affineCubeMinorThreshold_pos J O α h hN d hc₀ hδ hη have hp (j : J) : (blockCubeMeasure B (Fin h) α).real {a | |booleanMinorDeterminant (c j) sets (block j) (⟨0, hh⟩ : Fin h) (sel j) (fun z => center z + width z * a z)| < 2 * κ} ≤ K * (2 * κ * scale) ^ (((N * d : ℕ) : ℝ)⁻¹) := by have hm : (blockCubeMeasure B (Fin h) α).real {a | |booleanMinorDeterminant (c j) sets (block j) (⟨0, hh⟩ : Fin h) (sel j) (fun z => center z + width z * a z)| < 2 * κ} ≤ (blockCubeMeasure B (Fin h) α).real {a | |booleanMinorDeterminant (c j) sets (block j) (⟨0, hh⟩ : Fin h) (sel j) (fun z => center z + width z * a z)| ≤ 2 * κ} := by apply measureReal_mono · intro a ha change |booleanMinorDeterminant (c j) sets (block j) (⟨0, hh⟩ : Fin h) (sel j) (fun z => center z + width z * a z)| ≤ 2 * κ exact le_of_lt ha · exact measure_ne_top _ _ apply hm.trans have hb := hsel j d hd hdeg center width δ (2 * κ) hδ (hwidth j) (hbox j) (by positivity) simpa only [K, scale, cubeMinorProbabilityConstant, cubeMinorProbabilityScale, div_eq_mul_inv, mul_assoc, mul_left_comm, mul_comm] using hb calc _ ≤ ∑ _j : J, K * (2 * κ * scale) ^ (((N * d : ℕ) : ℝ)⁻¹) := Finset.sum_le_sum (fun j _ => hp j) _ = (Fintype.card J : ℝ) * K * (2 * κ * scale) ^ (((N * d : ℕ) : ℝ)⁻¹) := by rw [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] ring _ ≤ η / 2 := polynomialSublevelThreshold_total_bound (Nat.mul_pos hN hd) hK.le hscale.le hη
end Erdos3
end
section
namespace Erdos3
lemma log_one_add_inverse_width_pow {A δ : ℝ} (hA : 0 ≤ A) (hδ : 0 < δ) (hδone : δ ≤ 1) (N : ℕ) : Real.log (1 + A * δ⁻¹ ^ N) ≤ Real.log (1 + A) + (N : ℝ) * Real.log δ⁻¹ := by have hi : 1 ≤ δ⁻¹ := (one_le_inv₀ hδ).mpr hδone have hp : 1 ≤ δ⁻¹ ^ N := one_le_pow₀ hi have hmul : 1 + A * δ⁻¹ ^ N ≤ (1 + A) * δ⁻¹ ^ N := by nlinarith have hlog := Real.log_le_log (show 0 < 1 + A * δ⁻¹ ^ N by positivity) hmul rw [Real.log_mul (by positivity : (1 + A : ℝ) ≠ 0) (by positivity : δ⁻¹ ^ N ≠ 0), Real.log_pow] at hlog exact hlog
theorem affineCubeMinorThreshold_log_inv_slice_bound (J O α : Type*) [Fintype J] [Fintype O] [Fintype α] [DecidableEq α] (h : ℕ) {N : ℕ} (hN : 0 < N) (d : ℕ) {c₀ δ η : ℝ} (hc₀ : 0 < c₀) (hδ : 0 < δ) (hδone : δ ≤ 1) (hη : 0 < η) : Real.log (affineCubeMinorThreshold J O α h N d c₀ δ η)⁻¹ ≤ Real.log 2 + Real.log (1 + cubeMinorProbabilityScale O N d c₀) + (N * d : ℕ) * (Real.log (1 + 2 * cubeMinorProbabilityConstant O α h N d * (Fintype.card J + 1 : ℝ) / η) + (N : ℝ) * Real.log δ⁻¹) := by rw [affineCubeMinorThreshold_log_inv J O α h hN d hc₀ hδ hη] apply add_le_add le_rfl apply mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg (N * d)) have hA : 0 ≤ 2 * cubeMinorProbabilityConstant O α h N d * (Fintype.card J + 1 : ℝ) / η := div_nonneg (mul_nonneg (mul_nonneg (by norm_num) (cubeMinorProbabilityConstant_pos O α h hN d).le) (by positivity)) hη.le have hb := log_one_add_inverse_width_pow hA hδ hδone N convert hb using 1 congr 1 ring
end Erdos3
end
section
namespace Erdos3
open MeasureTheoryopen scoped ContDiff BigOperators
variable {B O J α : Type*} [Fintype B] [Fintype O] [Fintype J] [Fintype α] [DecidableEq B] [DecidableEq O] [DecidableEq α] {h : ℕ}
noncomputable def affineBooleanCubeDeterminant (c : B → ℝ) (sets : O → Finset α) (block : O → B) (v : Fin h) (sel : O → Option α) (L : (BlockParameter B (Fin h) α → ℝ) →L[ℝ] (BlockParameter B (Fin h) α → ℝ)) (b : BlockParameter B (Fin h) α → ℝ) (x : (B × Fin h) → Option α → ℝ) : ℝ := booleanMinorDeterminant c sets block v sel (b + L (blockCubeFlatten B (Fin h) α x))
theorem affineBooleanCubeDeterminant_contDiff (c : B → ℝ) (sets : O → Finset α) (block : O → B) (v : Fin h) (sel : O → Option α) (L : (BlockParameter B (Fin h) α → ℝ) →L[ℝ] (BlockParameter B (Fin h) α → ℝ)) (b : BlockParameter B (Fin h) α → ℝ) : ContDiff ℝ ∞ (affineBooleanCubeDeterminant c sets block v sel L b) := (booleanMinorDeterminant_contDiff c sets block v sel).comp (contDiff_const.add (L.contDiff.comp (blockCubeFlatten B (Fin h) α).contDiff))
noncomputable def affineBooleanCubeGoodWeight (c : J → B → ℝ) (sets : O → Finset α) (block : J → O → B) (v : Fin h) (sel : J → O → Option α) (L : (BlockParameter B (Fin h) α → ℝ) →L[ℝ] (BlockParameter B (Fin h) α → ℝ)) (b : BlockParameter B (Fin h) α → ℝ) (ψ : ℝ → ℝ) (r : B × Fin h → ℝ) (κ : J → ℝ) : (BlockParameter B (Fin h) α → ℝ) → ℝ := blockCubeWeight (scalarCubeGoodWeight α ψ r κ (fun j => affineBooleanCubeDeterminant (c j) sets (block j) v (sel j) L b))
noncomputable def affineBooleanCubeCutoff (c : J → B → ℝ) (sets : O → Finset α) (block : J → O → B) (v : Fin h) (sel : J → O → Option α) (L : (BlockParameter B (Fin h) α → ℝ) →L[ℝ] (BlockParameter B (Fin h) α → ℝ)) (b : BlockParameter B (Fin h) α → ℝ) (ψ : ℝ → ℝ) (r : B × Fin h → ℝ) (κ : J → ℝ) (a : BlockParameter B (Fin h) α → ℝ) : ℝ := goodDomainCutoff ψ κ (fun j => affineBooleanCubeDeterminant (c j) sets (block j) v (sel j) L b) (scalarCubeProductCutoff α r) ((blockCubeFlatten B (Fin h) α).symm a)
variable (c : J → B → ℝ) (sets : O → Finset α) (block : J → O → B) (v : Fin h) (sel : J → O → Option α) (L : (BlockParameter B (Fin h) α → ℝ) →L[ℝ] (BlockParameter B (Fin h) α → ℝ)) (b : BlockParameter B (Fin h) α → ℝ) (ψ : ℝ → ℝ) (r : B × Fin h → ℝ) (κ : J → ℝ)
theorem affineBooleanCubeCutoff_contDiff (hψ : ContDiff ℝ ∞ ψ) : ContDiff ℝ ∞ (affineBooleanCubeCutoff c sets block v sel L b ψ r κ) := (goodDomainCutoff_smooth ψ hψ κ _ (fun j => affineBooleanCubeDeterminant_contDiff (c j) sets (block j) v (sel j) L b) _ (scalarCubeProductCutoff_smooth r)).comp (blockCubeFlatten B (Fin h) α).symm.contDiff
theorem affineBooleanCubeCutoff_range (hrange : ∀ t, ψ t ∈ Set.Icc (0 : ℝ) 1) (x : BlockParameter B (Fin h) α → ℝ) : affineBooleanCubeCutoff c sets block v sel L b ψ r κ x ∈ Set.Icc (0 : ℝ) 1 := goodDomainCutoff_range ψ hrange κ _ _ (scalarCubeProductCutoff_range r) _
theorem affineBooleanCubeGoodWeight_spec (hψ : ContDiff ℝ ∞ ψ) (hrange : ∀ t, ψ t ∈ Set.Icc (0 : ℝ) 1) (hzero : ∀ t, |t| ≤ 1 → ψ t = 0) (hr : ∀ i, 0 < r i) (hκ : ∀ j, 0 < κ j) : let w := affineBooleanCubeGoodWeight c sets block v sel L b ψ r κ ContDiff ℝ 1 w ∧ HasCompactSupport w ∧ (∀ a, 0 ≤ w a) ∧ (∫ a, |w a|) ≤ 1 ∧ ∀ a ∈ tsupport w, (∀ z, |a z| ≤ 1) ∧ ∀ j, κ j ≤ |booleanMinorDeterminant (c j) sets (block j) v (sel j) (b + L a)| := by let d := fun j => affineBooleanCubeDeterminant (c j) sets (block j) v (sel j) L b have hs := scalarCubeGoodWeight_spec ψ hψ hrange hzero r hr κ hκ d (fun j => affineBooleanCubeDeterminant_contDiff (c j) sets (block j) v (sel j) L b) refine ⟨blockCubeWeight_contDiff _ hs.1, blockCubeWeight_compact _ hs.2.1, fun a => hs.2.2.2.1 _, ?_, ?_⟩ · change (∫ a, |blockCubeWeight (scalarCubeGoodWeight α ψ r κ d) a|) ≤ 1 rw [blockCubeWeight_abs_integral] exact hs.2.2.2.2 · intro a ha refine ⟨blockCubeWeight_box _ (fun x hx => (hs.2.2.1 hx).1) ha, ?_⟩ change a ∈ tsupport (blockCubeWeight (scalarCubeGoodWeight α ψ r κ d)) at ha rw [blockCubeWeight_tsupport] at ha intro j simpa only [d, affineBooleanCubeDeterminant, ContinuousLinearEquiv.apply_symm_apply] using (hs.2.2.1 ha).2 j
theorem affineBooleanCubeGoodWeight_integral_test (hr : ∀ i, 0 < r i) (f : (BlockParameter B (Fin h) α → ℝ) → ℝ) : (∫ a, affineBooleanCubeGoodWeight c sets block v sel L b ψ r κ a * f a) = ∫ a, affineBooleanCubeCutoff c sets block v sel L b ψ r κ a * f a ∂blockCubeMeasure B (Fin h) α := by unfold affineBooleanCubeGoodWeight rw [blockCubeWeight_integral_test, blockCubeMeasure_integral] simp only [affineBooleanCubeCutoff, ContinuousLinearEquiv.symm_apply_apply] exact scalarCubeGoodWeight_integral_test ψ r hr κ _ _
theorem affineBooleanCubeGoodWeight_measure (hψ : ContDiff ℝ ∞ ψ) (hrange : ∀ t, ψ t ∈ Set.Icc (0 : ℝ) 1) (hzero : ∀ t, |t| ≤ 1 → ψ t = 0) (hr : ∀ i, 0 < r i) (hκ : ∀ j, 0 < κ j) : realDensityMeasure volume (affineBooleanCubeGoodWeight c sets block v sel L b ψ r κ) = realDensityMeasure (blockCubeMeasure B (Fin h) α) (affineBooleanCubeCutoff c sets block v sel L b ψ r κ) := by let w := affineBooleanCubeGoodWeight c sets block v sel L b ψ r κ let χ := affineBooleanCubeCutoff c sets block v sel L b ψ r κ have hw := affineBooleanCubeGoodWeight_spec c sets block v sel L b ψ r κ hψ hrange hzero hr hκ have hm : Measurable χ := (affineBooleanCubeCutoff_contDiff c sets block v sel L b ψ r κ hψ).continuous.measurable have h01 := affineBooleanCubeCutoff_range c sets block v sel L b ψ r κ hrange let : IsFiniteMeasure (realDensityMeasure volume w) := realDensityMeasure_finite volume w (hw.1.continuous.integrable_of_hasCompactSupport hw.2.1) hw.2.2.1 let : IsFiniteMeasure (realDensityMeasure (blockCubeMeasure B (Fin h) α) χ) := realDensityMeasure_finite _ χ (cutoff_integrable _ χ hm h01) (fun a => (h01 a).1) apply finiteMeasure_eq_of_integrals intro f _ rw [realDensityMeasure_integral volume w hw.1.continuous.measurable hw.2.2.1, realDensityMeasure_integral _ χ hm (fun a => (h01 a).1)] exact affineBooleanCubeGoodWeight_integral_test c sets block v sel L b ψ r κ hr f
theorem affineBooleanCubeGoodWeight_mass_lower (hψ : ContDiff ℝ ∞ ψ) (hrange : ∀ t, ψ t ∈ Set.Icc (0 : ℝ) 1) (hone : ∀ t, 2 ≤ |t| → ψ t = 1) (hr : ∀ i, 0 < r i) (hκ : ∀ j, 0 < κ j) : 1 - scalarCubeBoundaryConstant α * ∑ i, r i - ∑ j, (blockCubeMeasure B (Fin h) α).real {a | |booleanMinorDeterminant (c j) sets (block j) v (sel j) (b + L a)| < 2 * κ j} ≤ ∫ a, affineBooleanCubeGoodWeight c sets block v sel L b ψ r κ a := by unfold affineBooleanCubeGoodWeight rw [blockCubeWeight_integral] have hs := scalarCubeGoodWeight_mass_lower ψ hψ hrange hone r hr κ hκ (fun j => affineBooleanCubeDeterminant (c j) sets (block j) v (sel j) L b) (fun j => affineBooleanCubeDeterminant_contDiff (c j) sets (block j) v (sel j) L b) have he (j : J) : (scalarCubeProductMeasure (B × Fin h) α).real {x | |affineBooleanCubeDeterminant (c j) sets (block j) v (sel j) L b x| < 2 * κ j} = (blockCubeMeasure B (Fin h) α).real {a | |booleanMinorDeterminant (c j) sets (block j) v (sel j) (b + L a)| < 2 * κ j} := by symm exact blockCubeMeasure_real_apply _ (measurableSet_lt (((booleanMinorDeterminant_contDiff (c j) sets (block j) v (sel j)).comp (contDiff_const.add L.contDiff)).continuous.measurable.abs) measurable_const) simp_rw [he] at hs exact hs
end Erdos3
end
section
namespace Erdos3
open MeasureTheoryopen scoped ContDiff BigOperators NNReal
variable {B O J α : Type*} [Fintype B] [Fintype O] [Fintype J] [Fintype α] [DecidableEq B] [DecidableEq O] [DecidableEq α] {h : ℕ}
theorem affineBooleanCubeDeterminant_fderiv_norm_le (c : B → ℝ) (sets : O → Finset α) (block : O → B) (v : Fin h) (sel : O → Option α) (hcard : ∀ o, (sets o).card ≤ h) (L : (BlockParameter B (Fin h) α → ℝ) →L[ℝ] (BlockParameter B (Fin h) α → ℝ)) (b : BlockParameter B (Fin h) α → ℝ) (hL : ‖L‖ ≤ 1) {C : ℝ} (hC : 0 ≤ C) (hc : ∀ o, |c (block o)| ≤ C) (x : (B × Fin h) → Option α → ℝ) (hx : ∀ z, |(b + L (blockCubeFlatten B (Fin h) α x)) z| ≤ 1) : ‖fderiv ℝ (affineBooleanCubeDeterminant c sets block v sel L b) x‖ ≤ productMinorDeterminantDerivativeBound (Fintype.card (BlockParameter B (Fin h) α)) (Fintype.card O) (Fintype.card α) h C 1 := by let e := (blockCubeFlatten B (Fin h) α).toContinuousLinearMap have hLe : ‖L.comp e‖ ≤ 1 := by apply (ContinuousLinearMap.opNorm_comp_le L e).trans exact (mul_le_mul hL (blockCubeFlatten_norm_le_one B (Fin h) α) (norm_nonneg _) zero_le_one).trans_eq (one_mul 1) have hF := (booleanMinorDeterminant_contDiff c sets block v sel).differentiable (by norm_num) have hd := affineSlice_fderiv (booleanMinorDeterminant c sets block v sel) b (L.comp e) x (hF (b + (L.comp e) x)) change fderiv ℝ (affineBooleanCubeDeterminant c sets block v sel L b) x = _ at hd rw [hd] exact ((ContinuousLinearMap.opNorm_comp_le _ _).trans (mul_le_of_le_one_right (norm_nonneg _) hLe)).trans (booleanMinorDeterminant_fderiv_norm_le c sets block v sel hcard _ hC le_rfl hc hx)
theorem affineBooleanCubeGoodWeight_derivative_budget (c : J → B → ℝ) (sets : O → Finset α) (block : J → O → B) (v : Fin h) (sel : J → O → Option α) (hcard : ∀ o, (sets o).card ≤ h) (L : (BlockParameter B (Fin h) α → ℝ) →L[ℝ] (BlockParameter B (Fin h) α → ℝ)) (b : BlockParameter B (Fin h) α → ℝ) (hL : ‖L‖ ≤ 1) (hbox : ∀ x ∈ scalarCubeProductDomain (B × Fin h) α, ∀ z, |(b + L (blockCubeFlatten B (Fin h) α x)) z| ≤ 1) (C : J → ℝ) (hC : ∀ j, 0 ≤ C j) (hc : ∀ j o, |c j (block j o)| ≤ C j) (ψ : ℝ → ℝ) (hψ : ContDiff ℝ ∞ ψ) (hrange : ∀ t, ψ t ∈ Set.Icc (0 : ℝ) 1) (A T : ℝ≥0) (hLip : LipschitzWith A ψ) (hTransition : LipschitzWith T Real.smoothTransition) (r : B × Fin h → ℝ) (hr : ∀ i, 0 < r i) (κ : J → ℝ) (hκ : ∀ j, 0 < κ j) : (∑ z : BlockParameter B (Fin h) α, ∫ a, |fderiv ℝ (affineBooleanCubeGoodWeight c sets block v sel L b ψ r κ) a (Pi.single z 1)|) ≤ (∑ i, ((2 * 2 ^ Fintype.card α : ℕ) : ℝ) * ((Fintype.card α : ℝ) + 1) ^ 2 * T / r i) + (Fintype.card (B × Fin h) : ℝ) * ((Fintype.card α : ℝ) + 1) * (∑ j, (A : ℝ) / κ j * productMinorDeterminantDerivativeBound (Fintype.card (BlockParameter B (Fin h) α)) (Fintype.card O) (Fintype.card α) h (C j) 1) := by let d := fun j => affineBooleanCubeDeterminant (c j) sets (block j) v (sel j) L b have hd := fun j => affineBooleanCubeDeterminant_contDiff (c j) sets (block j) v (sel j) L b have hw : ContDiff ℝ 1 (scalarCubeGoodWeight α ψ r κ d) := (scalarCubeProductWeight_spec (α := α) r hr).1.mul ((sublevelCutoffProduct_smooth ψ hψ κ d hd).of_le (by norm_num)) unfold affineBooleanCubeGoodWeight rw [blockCubeWeight_derivative_sum _ hw] let D : J → ℝ≥0 := fun j => ⟨productMinorDeterminantDerivativeBound (Fintype.card (BlockParameter B (Fin h) α)) (Fintype.card O) (Fintype.card α) h (C j) 1, productMinorDeterminantDerivativeBound_nonneg _ _ _ _ (hC j) zero_le_one⟩ exact scalarCubeGoodWeight_derivative_budget ψ hψ hrange A T hLip hTransition r hr κ hκ d hd D (fun j x hx => affineBooleanCubeDeterminant_fderiv_norm_le (c j) sets (block j) v (sel j) hcard L b hL (hC j) (hc j) x (hbox x hx))
end Erdos3
end
section
namespace Erdos3
open MeasureTheoryopen scoped BigOperators ContDiff
theorem exists_affine_cube_good_mass {B O J α : Type*} [Fintype B] [Fintype O] [Fintype J] [Fintype α] [DecidableEq B] [DecidableEq O] [DecidableEq α] (c : J → B → ℝ) (sets : O → Finset α) (hsets : Function.Injective sets) (h : ℕ) (hh : 0 < h) (hcard : ∀ o, (sets o).card ≤ h) (block : J → O → B) (hblock : ∀ j, Function.Injective (block j)) {N : ℕ} (e : BlockParameter O (Fin h) α ≃ Fin N) (hN : 0 < N) (d : ℕ) (hd : 0 < d) (hdeg : Fintype.card O * (h - 1) ≤ d) {c₀ : ℝ} (hc₀ : 0 < c₀) (hc : ∀ j o, c₀ ≤ |c j (block j o)|) (ψ : ℝ → ℝ) (hψ : ContDiff ℝ ∞ ψ) (hrange : ∀ t, ψ t ∈ Set.Icc (0 : ℝ) 1) (hone : ∀ t, 2 ≤ |t| → ψ t = 1) : ∃ sel : J → O → Option α, ∀ δ η : ℝ, 0 < δ → 0 < η → ∀ (center width : BlockParameter B (Fin h) α → ℝ) (hw : ∀ z, width z ≠ 0), (∀ j z, δ ≤ |restrictBlockParameters (block j) width z|) → (∀ j z, |restrictBlockParameters (block j) center z| + |restrictBlockParameters (block j) width z| ≤ 1) → 1 - η ≤ ∫ a, affineBooleanCubeGoodWeight c sets block (⟨0, hh⟩ : Fin h) sel (coordinateScaleEquiv width hw).toContinuousLinearEquiv.toContinuousLinearMap center ψ (fun _ => scalarCubeProductBoundaryRadius (B × Fin h) α (η / 2)) (fun _ => affineCubeMinorThreshold J O α h N d c₀ δ η) a := by obtain ⟨sel, hs⟩ := exists_affine_cube_minor_thresholds c sets hsets h hh hcard block hblock e hN d hd hdeg hc₀ hc refine ⟨sel, ?_⟩ intro δ η hδ hη center width hw hwidth hbox let κ := affineCubeMinorThreshold J O α h N d c₀ δ η have hκ : 0 < κ := affineCubeMinorThreshold_pos J O α h hN d hc₀ hδ hη have hr := scalarCubeProductBoundaryRadius_pos (B × Fin h) α (half_pos hη) have hm := affineBooleanCubeGoodWeight_mass_lower c sets block (⟨0, hh⟩ : Fin h) sel (coordinateScaleEquiv width hw).toContinuousLinearEquiv.toContinuousLinearMap center ψ (fun _ => scalarCubeProductBoundaryRadius (B × Fin h) α (η / 2)) (fun _ => κ) hψ hrange hone (fun _ => hr) (fun _ => hκ) have hp := hs δ η hδ hη center width hwidth hbox have he (a : BlockParameter B (Fin h) α → ℝ) : center + (coordinateScaleEquiv width hw).toContinuousLinearEquiv.toContinuousLinearMap a = fun z => center z + width z * a z := rfl simp only [he] at hm have hb := scalarCubeProductBoundaryRadius_loss (B × Fin h) α (half_pos hη) linarith only [hm, hp, hb]
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103import OAI.Combinatorics.Progressions.Estimates.WeightedPlateauSiteApproximation
namespace OAI
section
namespace Erdos3
open MeasureTheoryopen scoped BigOperators Classical NNReal
variable {B α T : Type*} [Fintype B] [DecidableEq B] [Fintype α] [DecidableEq α]variable {n K M : ℕ} [NeZero M]variable (s : B → Fin (n + 1) → NormalizedScalarCubeSource α)variable (u : B → Fin (n + 1) → Option α → ℤ) (v : B → Fin (n + 1) → Option α → ℕ)
noncomputable def affineCubePlateauCoefficient (K M : ℕ) (rows : Finset (Finset α)) (k : rows → Fin M) : ℂ := ((K : ℂ) / M) ^ rows.card * ∏ b, affineWeightedCubeGridCoefficient (s b) (fun j i => (u b j i : ℝ)) (v b) M rows k
omit [NeZero M] [DecidableEq B] intheorem affineCubePlateauCoefficient_sum_le (rows : Finset (Finset α)) (F : Finset (rows → Fin M)) (hscale : ((K : ℝ) / M) ^ rows.card ≤ 1) {C : ℝ} (hcap : (∑ k, ‖∏ b, affineWeightedCubeGridCoefficient (s b) (fun j i => (u b j i : ℝ)) (v b) M rows k‖) ≤ C) : (∑ k : F, ‖affineCubePlateauCoefficient s u v K M rows k‖) ≤ C := by rw [← Finset.sum_subtype F (fun _ => Iff.rfl) (fun k => ‖affineCubePlateauCoefficient s u v K M rows k‖)] simp only [affineCubePlateauCoefficient, norm_mul, norm_pow, norm_div, Complex.norm_natCast, ← Finset.mul_sum] have hC : 0 ≤ C := (Finset.sum_nonneg (fun _ _ => norm_nonneg _)).trans hcap apply (mul_le_mul_of_nonneg_left ((Finset.sum_le_univ_sum_of_nonneg (fun _ => norm_nonneg _)).trans hcap) (by positivity)).trans exact mul_le_of_le_one_left hC hscale
variable [Countable T] [MeasurableSpace T] [MeasurableSingletonClass T]
theorem affineCubePlateauMixture_model (p : PMF T) (hK : 0 < K) (H : ℝ) (rows : Finset (Finset α)) (F : Finset (rows → Fin M)) (D : (rows → Fin M) → ℕ) [∀ k, NeZero (D k)] (a : (rows → Fin M) → rows → ℤ) (ω : (rows → Fin M) → rows → ℝ) (hfreq : ∀ k ∈ F, ∀ t, ((k t).val : ℝ) / M = (a k t : ℝ) / D k + ω k t / K) (shift : T → rows → ℤ) (z : rows → ℤ) : (∫ zeta, affineCubePlateauApproximation s u v K H rows (shift zeta) z F ∂p.toMeasure) = finiteResidueModeModel (fun k : F => D k) (fun k => a k) (fun k => affineCubePlateauCoefficient s u v K M rows k) (fun k => plateauModeMixture p H (D k) K (a k) (ω k) shift) (fun k => integerGridResidue (D k) z) (fun t => (z t : ℝ) / K) := by rw [affineCubePlateauMixture_expansion s u v p hK H rows shift z F D a ω hfreq] let term (k : rows → Fin M) := affineCubePlateauCoefficient s u v K M rows k * (star (rationalGridPhase (D k) (a k) (integerGridResidue (D k) z)) * plateauModeMixture p H (D k) K (a k) (ω k) shift (fun t => (z t : ℝ) / K)) calc _ = ∑ k ∈ F, term k := by simp only [term, affineCubePlateauCoefficient, Finset.mul_sum, mul_assoc] _ = ∑ k : F, term k := Finset.sum_subtype F (fun _ => Iff.rfl) term _ = _ := rfl
theorem exists_affineCube_plateau_site_approximation (p : PMF T) (hK : 0 < K) (H : ℝ) (rows : Finset (Finset α)) (F : Finset (rows → Fin M)) (D : (rows → Fin M) → ℕ) [∀ k, NeZero (D k)] (a : (rows → Fin M) → rows → ℤ) (ω : (rows → Fin M) → rows → ℝ) (hfreq : ∀ k ∈ F, ∀ t, ((k t).val : ℝ) / M = (a k t : ℝ) / D k + ω k t / K) (shift : T → rows → ℤ) (hscale : ((K : ℝ) / M) ^ rows.card ≤ 1) {C : ℝ} (hcap : (∑ k, ‖∏ b, affineWeightedCubeGridCoefficient (s b) (fun j i => (u b j i : ℝ)) (v b) M rows k‖) ≤ C) (W : ℝ≥0) (hW : ∀ k ∈ F, ∀ t, |ω k t| ≤ W) {R δ P : ℝ} (hR : 0 < R) (hδ : 0 < δ) (hP : 0 ≤ P) (hRP : R ≤ Real.exp P) (hδP : (δ / (C + 1))⁻¹ ≤ Real.exp P) (hLP : ((CircleFourier.characterLipConstant * (rows.card * W) + 4) * (2 : ℝ≥0) ^ Fintype.card α : ℝ≥0) ≤ Real.exp P) : ∃ N : F → ℕ, (∀ k, (N k : ℝ) ≤ Real.exp (4 * P + 8)) ∧ (Fintype.card (PlateauSiteIndex α F N) : ℝ) ≤ F.card * Real.exp (Fintype.card (Finset α) * (4 * P + 8)) ∧ ∃ (β : PlateauSiteIndex α F N → ℂ) (f : (k : PlateauSiteIndex α F N) → Finset α → ZMod (D k.1) → ℝ → ℂ), (∑ k, ‖β k‖) ≤ C * Real.exp (Fintype.card (Finset α) * (4 * P + 8) + P) ∧ (∀ k u r x, ‖f k u r x‖ ≤ 1) ∧ (∀ k u r, LipschitzWith ⟨Real.exp (1 + 6 * P + 12), Real.exp_nonneg _⟩ (f k u r)) ∧ ∀ y : Finset α → ℤ, (∀ u, |(y u : ℝ) / K| ≤ R) → ‖(∫ zeta, affineCubePlateauApproximation s u v K H rows (shift zeta) (fun t => booleanCoefficient y t) F ∂p.toMeasure) - ∑ k, β k * ∏ u, f k u (y u : ZMod (D k.1)) ((y u : ℝ) / K)‖ ≤ δ := by have hC : 0 ≤ C := (Finset.sum_nonneg (fun _ _ => norm_nonneg _)).trans hcap have htol : 0 < δ / (C + 1) := div_pos hδ (by positivity) obtain ⟨N, hN, hcard, β, f, hβ, hf, hLf, he⟩ := exists_integer_plateau_sum_site_approximation p H K rows (fun k : F => D k) (fun k => a k) (fun k => ω k) shift (fun k => affineCubePlateauCoefficient s u v K M rows k) (affineCubePlateauCoefficient_sum_le s u v rows F hscale hcap) W (fun k => hW k k.property) hR htol hP hRP hδP hLP refine ⟨N, hN, ?_, β, f, hβ, hf, hLf, ?_⟩ · simpa only [Fintype.card_coe] using hcard · intro y hy rw [affineCubePlateauMixture_model s u v p hK H rows F D a ω hfreq shift] apply (he y hy).trans rw [← mul_div_assoc] apply (div_le_iff₀ (by positivity : 0 < C + 1)).mpr nlinarith only [hC, hδ]
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361import OAI.Combinatorics.Progressions.Fourier.SectionRetainedFourierimport OAI.Combinatorics.Progressions.Fourier.SiteFourierHaarMean
namespace OAI
section
namespace Erdos3.BooleanCubeKernel
open VectorPolynomialopen scoped BigOperators
theorem exists_affine_cube_approximated_projection (m q : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {J : Fin m → Type*} [∀ j, Fintype (J j)] {F : Type*} [Fintype F] {P : ℝ} (_hP : 0 ≤ P) (_hn : (Fintype.card I : ℝ) ≤ P) (_hd : (Fintype.card (Option K × I) : ℝ) ≤ P) (U : ∀ j, Submodule ℝ (J j → ℝ)) (root : K → ℤ) (difference : Fin q → K → ℤ) (_hlin : LinearIndependent ℝ (fun i k => (difference i k : ℝ))) {L C : ℝ} (_hL : 0 ≤ L) (_hC : 0 ≤ C) (_hLP : L ≤ Real.exp P) (_hCP : C ≤ Real.exp P) (_hsite : ∀ (s : Finset (Fin q)) k, |((affineSite root difference s (some k) : ℤ) : ℝ)| ≤ L) (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (_hbound : ∀ a j d, d.degree ≤ j.val + 1 → ∀ t, |(frequency a j d t : ℝ)| ≤ C) (c : F → ℂ) {B : ℝ} (_hB : 0 ≤ B) (_hBP : B ≤ Real.exp P) (_hcoefficients : (∑ a, ‖c a‖) ≤ B) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (_hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (_hm : ∀ j d, coefficients (p j) d ∈ U j) (stride : I → ℕ) (_hs : ∀ k, 0 < stride k) {R S ρ ε : ℝ} (_hS : 0 ≤ S) (_hSP : S ≤ Real.exp P) (_hρ : 0 < ρ) (_hε : 0 < ε) (_hρP : 1 / ρ ≤ Real.exp P) (_hεP : 1 / ε ≤ Real.exp P) (_hstride : ∀ k, (stride k : ℝ) ≤ S) (H : I → ℝ) (_hsize : ∀ k, Real.exp ((P + A) ^ A) ≤ H k) (_hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (_hR : Real.exp ((P + A) ^ A) ≤ R) (Q : MvPolynomial (Option K × I) ℝ) (_hQ : Q.totalDegree ≤ 0) (test : Finset (Fin q) → (I → ℝ) → ℂ) (_htest : ∀ t v, ‖test t v‖ ≤ 1) (G : Finset (ColumnResiduePattern (Option K) I stride)) (_hG : G.Nonempty) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (_hwidth : ∀ z, ρ * H z.2 ≤ V z) (f g : (Option K × I → ℤ) → ℂ) {η : ℝ} (_hη : 0 ≤ η) (_hf : ∀ z ∈ rectangularWeightIndices 0 V 1, ‖f z - affineCubeFourierSum frequency p c (fun k j => (z (k, j) : ℝ))‖ ≤ η) (_hg : ∀ z ∈ rectangularWeightIndices 0 V 1, ‖affineCubeFourierProjection U root difference frequency p c (fun k j => (z (k, j) : ℝ)) - g z‖ ≤ η), ∃ hZ : 0 < ∑' x, selectedResidueSmoothWeight stride G V x, ‖(∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * (layeredSiteWeight Q (fun s => affineSite root difference s) test (fun k j => (z (k, j) : ℝ)) * f z)) - (∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * (layeredSiteWeight Q (fun s => affineSite root difference s) test (fun k j => (z (k, j) : ℝ)) * g z))‖ ≤ 2 * η + ε := by obtain ⟨A, hA, hprojection⟩ := exists_affine_cube_fourier_projection m q refine ⟨A, hA, ?_⟩ intro I K _ _ _ J _ F _ P hP hn hd U root difference hlin L C hL hC hLP hCP hsite frequency hbound c B hB hBP hcoefficients p hp hm stride hs R S ρ ε hS hSP hρ hε hρP hεP hstride H hsize hrank hR Q hQ test htest G hG V hV hwidth f g η hη hf hg obtain ⟨hZ, hproj⟩ := hprojection hP hn hd U root difference hlin hL hC hLP hCP hsite frequency hbound c hB hBP hcoefficients p hp hm stride hs hS hSP hρ hε hρP hεP hstride H hsize hrank hR Q hQ test htest G hG V hV hwidth refine ⟨hZ, ?_⟩ exact selectedResidueSmoothPMF_projection_approximation stride G V hV hZ (fun z => layeredSiteWeight Q (fun s => affineSite root difference s) test (fun k j => (z (k, j) : ℝ))) f (fun z => affineCubeFourierSum frequency p c (fun k j => (z (k, j) : ℝ))) (fun z => affineCubeFourierProjection U root difference frequency p c (fun k j => (z (k, j) : ℝ))) g hη (fun z _ => layeredSiteWeight_norm_le Q _ test htest _) hf hg hproj
end Erdos3.BooleanCubeKernel
end
section
namespace Erdos3.BooleanCubeKernel
open VectorPolynomialopen scoped Classical
theorem affineCubeModeFactors_iff_bounded {K : Type*} [Fintype K] {m q : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) (root : K → ℤ) (difference : Fin q → K → ℤ) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) : affineCubeModeFactors U root difference frequency ↔ ∀ j, ∃ M : (Finset (Fin q) → U j) →ₗ[ℝ] ℝ, ∀ p : VectorPolynomial K ℝ (U j), DegreeLE (1 : K → ℕ) (j.val + 1) p → coefficientFunctional (fun d a => (frequency j d a : ℝ)) (map (U j).subtype p) = M (VectorPolynomial.siteEvaluation (fun s k => ((affineSite root difference s (some k) : ℤ) : ℝ)) p) := by constructor · exact affineCubeModeFactors_bounded U root difference frequency · intro h j obtain ⟨M, hM⟩ := h j refine ⟨M, ?_⟩ let L := (coefficientFunctional (fun d a => (frequency j d a : ℝ))).comp (map (U j).subtype) have hh := (homogeneous_site_factorization_iff (j.val + 1) (fun s k => ((affineSite root difference s (some k) : ℤ) : ℝ)) L M).mpr hM change ∀ p, Homogeneous (j.val + 1) p → affineModeLift L p = _ at hh have he : (fun s (k : Option K) => k.elim (1 : ℝ) (fun k => ((affineSite root difference s (some k) : ℤ) : ℝ))) = (fun s => affineSite (fun k => (root k : ℝ)) (fun i k => (difference i k : ℝ)) s) := by funext s k cases k <;> simp [affineSite, Int.cast_sum] simpa only [L, affineModeLift_comp_map, LinearMap.comp_apply, he] using hh
theorem exists_affine_cube_residual {K : Type*} [Fintype K] (m q : ℕ) (root : K → ℤ) (difference : Fin q → K → ℤ) {H : ℕ} (hH : 1 ≤ H) (hsite : ∀ (s : Finset (Fin q)) k, (affineSite root difference s (some k)).natAbs ≤ H) : ∃ (d : Fin m → ℕ) (T : ∀ j : Fin m, Matrix (BoundedCoefficientExponent K (j.val + 1)) (Finset (Fin q)) ℤ), (∀ j, 0 < d j) ∧ ∀ {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)), let R := coefficientSiteResidual U (fun s k => affineSite root difference s (some k)) d T (∀ x ∈ coefficientIntegerLattice U, R x ∈ coefficientIntegerLattice U) ∧ ∀ frequency : ∀ j, (K →₀ ℕ) → J j → ℤ, (coefficientArrayFunctional U frequency).comp R = 0 ↔ affineCubeModeFactors U root difference frequency := by let site := fun s k => affineSite root difference s (some k) have hex (j : Fin m) := exists_integer_site_residual (boundedSiteMatrix (j.val + 1) site) (Nat.one_le_pow _ _ hH) (boundedSiteMatrix_height (j.val + 1) site hH hsite) choose d T hd hT _hbound using hex refine ⟨d, T, hd, ?_⟩ intro J _ U refine ⟨coefficientSiteResidual_preserves_lattice U site d T, ?_⟩ intro frequency rw [coefficientSiteResidual_zero_iff U site d T hd (fun j x => hT j x), affineCubeModeFactors_iff_bounded]
end Erdos3.BooleanCubeKernel
end
section
namespace Erdos3.BooleanCubeKernel
open MeasureTheory VectorPolynomialopen scoped BigOperators Classical
variable {K : Type*} [Fintype K] {m q : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) (R : CoefficientArray (K := K) U →ₗ[ℝ] CoefficientArray (K := K) U) (hR : ∀ x ∈ coefficientIntegerLattice U, R x ∈ coefficientIntegerLattice U) [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)]
theorem coefficientResidual_section_integrable {W : Type*} [NormedAddCommGroup W] [NormedSpace ℝ W] (μ : Measure (CoefficientTorus (K := K) U)) [IsFiniteMeasure μ] (f : CoefficientTorus (K := K) U → W) (hf : Continuous f) {B : ℝ} (hB : ∀ x, ‖f x‖ ≤ B) (x : CoefficientTorus (K := K) U) : Integrable (fun y => f (x + linearQuotientEndomorphism (coefficientIntegerLattice U) R hR y)) μ := by have hc := linearQuotientEndomorphism_continuous (coefficientIntegerLattice U) R hR R.continuous_of_finiteDimensional exact Integrable.of_bound (hf.comp (continuous_const.add hc)).aestronglyMeasurable B (ae_of_all μ (fun _ => hB _))
theorem coefficientResidualAverage_continuous {W : Type*} [NormedAddCommGroup W] [NormedSpace ℝ W] (μ : Measure (CoefficientTorus (K := K) U)) [IsFiniteMeasure μ] (f : CoefficientTorus (K := K) U → W) (hf : Continuous f) {B : ℝ} (hB : ∀ x, ‖f x‖ ≤ B) : Continuous (linearQuotientAverage (coefficientIntegerLattice U) R hR μ f) := by apply continuous_of_dominated (fun x => (coefficientResidual_section_integrable U R hR μ f hf hB x).aestronglyMeasurable) (fun _ => ae_of_all μ (fun _ => hB _)) (integrable_const B) exact ae_of_all μ (fun _ => hf.comp (continuous_id.add continuous_const))
theorem coefficientTorusFourierSum_residualAverage {F : Type*} [Fintype F] (root : K → ℤ) (difference : Fin q → K → ℤ) (hfactor : ∀ frequency : ∀ j, (K →₀ ℕ) → J j → ℤ, (coefficientArrayFunctional U frequency).comp R = 0 ↔ affineCubeModeFactors U root difference frequency) (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (c : F → ℂ) (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] (x : CoefficientTorus (K := K) U) : linearQuotientAverage (coefficientIntegerLattice U) R hR μ (coefficientTorusFourierSum U frequency c) x = ∑ a, if affineCubeModeFactors U root difference (frequency a) then c a * coefficientTorusCharacter U (frequency a) x else 0 := by have hi (a : F) := coefficientResidual_section_integrable U R hR μ (coefficientTorusCharacter U (frequency a)) (quotientLinearCharacter_continuous _ _ _ (coefficientArrayFunctional U (frequency a)).continuous_of_finiteDimensional) (fun x => (quotientLinearCharacter_norm _ _ _ x).le) x change (∫ y, ∑ a, c a * coefficientTorusCharacter U (frequency a) (x + linearQuotientEndomorphism (coefficientIntegerLattice U) R hR y) ∂μ) = _ rw [integral_finsetSum _ (fun a _ => (hi a).const_mul (c a))] simp only [integral_const_mul] change (∑ a, c a * linearQuotientAverage (coefficientIntegerLattice U) R hR μ (quotientLinearCharacter (coefficientIntegerLattice U) (coefficientArrayFunctional U (frequency a)) (coefficientArrayFunctional_integral U (frequency a))) x) = _ simp only [linearQuotientAverage_character, hfactor, mul_ite, mul_zero] rfl
theorem affineCubeFourierProjection_eq_residualAverage {I F : Type*} [Fintype F] (root : K → ℤ) (difference : Fin q → K → ℤ) (hfactor : ∀ frequency : ∀ j, (K →₀ ℕ) → J j → ℤ, (coefficientArrayFunctional U frequency).comp R = 0 ↔ affineCubeModeFactors U root difference frequency) (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (c : F → ℂ) (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (hm : ∀ j d, coefficients (p j) d ∈ U j) (b : Option K → I → ℝ) : affineCubeFourierProjection U root difference frequency p c b = linearQuotientAverage (coefficientIntegerLattice U) R hR μ (coefficientTorusFourierSum U frequency c) (affineSampleCoefficientTorus U p hm b) := by rw [coefficientTorusFourierSum_residualAverage U R hR root difference hfactor] simp only [coefficientTorusCharacter_sample U _ p hp hm b, affineCubeFourierProjection]
theorem coefficientTorusFourierProjection_approx_residualAverage {F : Type*} [Fintype F] (root : K → ℤ) (difference : Fin q → K → ℤ) (hfactor : ∀ frequency : ∀ j, (K →₀ ℕ) → J j → ℤ, (coefficientArrayFunctional U frequency).comp R = 0 ↔ affineCubeModeFactors U root difference frequency) (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (c : F → ℂ) (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] (D : CoefficientTorus (K := K) U → ℝ) {η : ℝ} (happrox : ∀ x, ‖coefficientTorusFourierSum U frequency c x - (D x : ℂ)‖ ≤ η) (x : CoefficientTorus (K := K) U) (hD : Integrable (fun y => D (x + linearQuotientEndomorphism (coefficientIntegerLattice U) R hR y)) μ) : ‖(∑ a, if affineCubeModeFactors U root difference (frequency a) then c a * coefficientTorusCharacter U (frequency a) x else 0) - ((linearQuotientAverage (coefficientIntegerLattice U) R hR μ D x : ℝ) : ℂ)‖ ≤ η := by rw [← coefficientTorusFourierSum_residualAverage U R hR root difference hfactor frequency c μ x] have hi : Integrable (fun y => coefficientTorusFourierSum U frequency c (x + linearQuotientEndomorphism (coefficientIntegerLattice U) R hR y)) μ := by apply integrable_finsetSum intro a _ apply Integrable.const_mul exact coefficientResidual_section_integrable U R hR μ (coefficientTorusCharacter U (frequency a)) (quotientLinearCharacter_continuous _ _ _ (coefficientArrayFunctional U (frequency a)).continuous_of_finiteDimensional) (fun x => (quotientLinearCharacter_norm _ _ _ x).le) x have he := linearQuotientAverage_approx (coefficientIntegerLattice U) R hR μ (coefficientTorusFourierSum U frequency c) (fun x => (D x : ℂ)) happrox x hi hD.ofReal simpa only [linearQuotientAverage, integral_complex_ofReal] using he
end Erdos3.BooleanCubeKernel
end
section
namespace Erdos3.BooleanCubeKernel
open MeasureTheory VectorPolynomialopen scoped BigOperators Classical
theorem exists_affine_cube_positive_density {K : Type*} [Fintype K] {m q : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) (root : K → ℤ) (difference : Fin q → K → ℤ) {H : ℕ} (hH : 1 ≤ H) (hsite : ∀ (s : Finset (Fin q)) k, (affineSite root difference s (some k)).natAbs ≤ H) [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] (D : CoefficientTorus (K := K) U → ℝ) (hD : Continuous D) {B : ℝ} (hcap : ∀ x, D x ∈ Set.Icc (0 : ℝ) B) (hmass : (∫ x, D x ∂μ) = 1) : ∃ g : CoefficientTorus (K := K) U → ℝ, Continuous g ∧ (∀ x, g x ∈ Set.Icc (0 : ℝ) B) ∧ Integrable g μ ∧ (∫ x, g x ∂μ) = 1 ∧ ∀ {F : Type*} [Fintype F] (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (c : F → ℂ) {η : ℝ}, (∀ x, ‖coefficientTorusFourierSum U frequency c x - (D x : ℂ)‖ ≤ η) → ∀ x, ‖(∑ a, if affineCubeModeFactors U root difference (frequency a) then c a * coefficientTorusCharacter U (frequency a) x else 0) - (g x : ℂ)‖ ≤ η := by obtain ⟨d, T, _, hR⟩ := exists_affine_cube_residual m q root difference hH hsite obtain ⟨hlattice, hfactor⟩ := hR U let R := coefficientSiteResidual U (fun s k => affineSite root difference s (some k)) d T let g := linearQuotientAverage (coefficientIntegerLattice U) R hlattice μ D have hRm := (linearQuotientEndomorphism_continuous (coefficientIntegerLattice U) R hlattice R.continuous_of_finiteDimensional).measurable have hb (x) : ‖D x‖ ≤ B := by rw [Real.norm_of_nonneg (hcap x).1]; exact (hcap x).2 have hi : Integrable D μ := Integrable.of_bound hD.aestronglyMeasurable B (ae_of_all μ hb) have hp := linearQuotientAverage_probability (coefficientIntegerLattice U) R hlattice μ hRm D hD.measurable hi (fun x => (hcap x).1) hmass refine ⟨g, ?_, ?_, hp.2.1, hp.2.2, ?_⟩ · exact coefficientResidualAverage_continuous U R hlattice μ D hD hb · intro x refine ⟨hp.1 x, ?_⟩ have h := linearQuotientAverage_bound (coefficientIntegerLattice U) R hlattice μ D hb x rwa [Real.norm_of_nonneg (hp.1 x)] at h · intro F _ frequency c η happrox x exact coefficientTorusFourierProjection_approx_residualAverage U R hlattice root difference hfactor frequency c μ D happrox x (coefficientResidual_section_integrable U R hlattice μ D hD hb x)
end Erdos3.BooleanCubeKernel
end
section
namespace Erdos3.BooleanCubeKernel
open MeasureTheory VectorPolynomialopen scoped BigOperators Classical
theorem exists_affine_cube_positive_comparison (m q : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {J : Fin m → Type*} [∀ j, Fintype (J j)] {F : Type*} [Fintype F] {P : ℝ} (_hP : 0 ≤ P) (_hn : (Fintype.card I : ℝ) ≤ P) (_hd : (Fintype.card (Option K × I) : ℝ) ≤ P) (U : ∀ j, Submodule ℝ (J j → ℝ)) (root : K → ℤ) (difference : Fin q → K → ℤ) (_hlin : LinearIndependent ℝ (fun i k => (difference i k : ℝ))) {L C : ℝ} (_hL : 0 ≤ L) (_hC : 0 ≤ C) (_hLP : L ≤ Real.exp P) (_hCP : C ≤ Real.exp P) (_hsite : ∀ (s : Finset (Fin q)) k, |((affineSite root difference s (some k) : ℤ) : ℝ)| ≤ L) (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (_hbound : ∀ a j d, d.degree ≤ j.val + 1 → ∀ t, |(frequency a j d t : ℝ)| ≤ C) (c : F → ℂ) {B : ℝ} (_hB : 0 ≤ B) (_hBP : B ≤ Real.exp P) (_hcoefficients : (∑ a, ‖c a‖) ≤ B) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (_hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (hm : ∀ j d, coefficients (p j) d ∈ U j) (stride : I → ℕ) (_hs : ∀ k, 0 < stride k) {R S ρ ε : ℝ} (_hS : 0 ≤ S) (_hSP : S ≤ Real.exp P) (_hρ : 0 < ρ) (_hε : 0 < ε) (_hρP : 1 / ρ ≤ Real.exp P) (_hεP : 1 / ε ≤ Real.exp P) (_hstride : ∀ k, (stride k : ℝ) ≤ S) (H : I → ℝ) (_hsize : ∀ k, Real.exp ((P + A) ^ A) ≤ H k) (_hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (_hR : Real.exp ((P + A) ^ A) ≤ R) (Q : MvPolynomial (Option K × I) ℝ) (_hQ : Q.totalDegree ≤ 0) (test : Finset (Fin q) → (I → ℝ) → ℂ) (_htest : ∀ t v, ‖test t v‖ ≤ 1) (G : Finset (ColumnResiduePattern (Option K) I stride)) (_hG : G.Nonempty) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (_hwidth : ∀ z, ρ * H z.2 ≤ V z) [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] (D : CoefficientTorus (K := K) U → ℝ) (_hD : Continuous D) {B₀ η : ℝ} (_hcap : ∀ x, D x ∈ Set.Icc (0 : ℝ) B₀) (_hmass : (∫ x, D x ∂μ) = 1) (_hη : 0 ≤ η) (_happrox : ∀ x, ‖coefficientTorusFourierSum U frequency c x - (D x : ℂ)‖ ≤ η), ∃ g : CoefficientTorus (K := K) U → ℝ, Continuous g ∧ (∀ x, g x ∈ Set.Icc (0 : ℝ) B₀) ∧ Integrable g μ ∧ (∫ x, g x ∂μ) = 1 ∧ ∃ hZ : 0 < ∑' x, selectedResidueSmoothWeight stride G V x, ‖(∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * (layeredSiteWeight Q (fun s => affineSite root difference s) test (fun k j => (z (k, j) : ℝ)) * (D (affineSampleCoefficientTorus U p hm (fun k j => (z (k, j) : ℝ))) : ℂ))) - (∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * (layeredSiteWeight Q (fun s => affineSite root difference s) test (fun k j => (z (k, j) : ℝ)) * (g (affineSampleCoefficientTorus U p hm (fun k j => (z (k, j) : ℝ))) : ℂ)))‖ ≤ 2 * η + ε := by obtain ⟨A, hA, hprojection⟩ := exists_affine_cube_approximated_projection m q refine ⟨A, hA, ?_⟩ intro I K _ _ _ J _ F _ P hP hn hd U root difference hlin L C hL hC hLP hCP hsite frequency hbound c B hB hBP hcoefficients p hp hm stride hs R S ρ ε hS hSP hρ hε hρP hεP hstride H hsize hrank hR Q hQ test htest G hG V hV hwidth _ _ μ _ _ D hD B₀ η hcap hmass hη happrox let H₀ := max 1 (Finset.univ.sup (fun sk : Finset (Fin q) × K => (affineSite root difference sk.1 (some sk.2)).natAbs)) have hH₀ : 1 ≤ H₀ := le_max_left _ _ have hsite₀ (s : Finset (Fin q)) (k : K) : (affineSite root difference s (some k)).natAbs ≤ H₀ := (Finset.le_sup (f := fun sk : Finset (Fin q) × K => (affineSite root difference sk.1 (some sk.2)).natAbs) (Finset.mem_univ (s, k))).trans (le_max_right _ _) obtain ⟨g, hgm, hgc, hgi, hgmass, hg⟩ := exists_affine_cube_positive_density U root difference hH₀ hsite₀ μ D hD hcap hmass refine ⟨g, hgm, hgc, hgi, hgmass, ?_⟩ apply hprojection hP hn hd U root difference hlin hL hC hLP hCP hsite frequency hbound c hB hBP hcoefficients p hp hm stride hs hS hSP hρ hε hρP hεP hstride H hsize hrank hR Q hQ test htest G hG V hV hwidth (fun z => (D (affineSampleCoefficientTorus U p hm (fun k j => (z (k, j) : ℝ))) : ℂ)) (fun z => (g (affineSampleCoefficientTorus U p hm (fun k j => (z (k, j) : ℝ))) : ℂ)) hη · intro z _ have h := happrox (affineSampleCoefficientTorus U p hm (fun k j => (z (k, j) : ℝ))) simpa only [coefficientTorusFourierSum, coefficientTorusCharacter_sample U _ p hp hm, affineCubeFourierSum, norm_sub_rev] using h · intro z _ have h := hg frequency c happrox (affineSampleCoefficientTorus U p hm (fun k j => (z (k, j) : ℝ))) simpa only [coefficientTorusCharacter_sample U _ p hp hm, affineCubeFourierProjection] using h
end Erdos3.BooleanCubeKernel
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222import OAI.Combinatorics.Progressions.Dynamics.CubeModeUniformBudget
namespace OAI
section
namespace Erdos3.BooleanCubeKernel
open VectorPolynomialopen scoped BigOperators NNReal
theorem affine_cube_removal_of_widths {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {m q : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) (root : K → ℤ) (difference : Fin q → K → ℤ) (hlin : LinearIndependent ℝ (fun i k => (difference i k : ℝ))) {L C : ℝ} (hL : 0 ≤ L) (hC : 0 ≤ C) (hsite : ∀ (s : Finset (Fin q)) k, |((affineSite root difference s (some k) : ℤ) : ℝ)| ≤ L) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) (hbound : ∀ j d, d.degree ≤ j.val + 1 → ∀ a, |(frequency j d a : ℝ)| ≤ C) (hbad : ∃ i, ¬∃ M : (Finset (Fin q) → U i) →ₗ[ℝ] ℝ, ∀ P, Homogeneous (i.val + 1) P → affineModeLift (coefficientFunctional (fun d a => (frequency i d a : ℝ))) (map (U i).subtype P) = M (VectorPolynomial.siteEvaluation (fun s => affineSite (fun k => (root k : ℝ)) (fun r k => (difference r k : ℝ)) s) P)) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (hm : ∀ j d, coefficients (p j) d ∈ U j) (stride : I → ℕ) (hs : ∀ k, 0 < stride k) {ζ R T S : ℝ} (hζ : 0 < ζ) (hT : 0 < T) (hS : 0 ≤ S) (hstride : ∀ k, (stride k : ℝ) ≤ S) (H : I → ℝ) (hH : ∀ k, 0 < H k) (hsize : ∀ k, (stride k : ℝ) * T * (finiteLayerBiasBudget m ζ + 1) ≤ H k) (hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (hR : layerRemovalRankBudget m (Fintype.card I) C (cubeModePolynomialBudget q L) (finiteLayerBiasBudget m ζ) (2 * T) S ≤ R) (Q : MvPolynomial (Option K × I) ℝ) (hQ : Q.totalDegree ≤ 0) (test : Finset (Fin q) → (I → ℝ) → ℂ) (htest : ∀ t v, ‖test t v‖ ≤ 1) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (hV1 : ∀ z, 1 ≤ V z) {δ : ℝ} (hδ : 0 ≤ δ) (hδ1 : δ ≤ 1) (hmesh : ∀ z, 1 / V z ≤ δ) (hsmall : (4 : ℝ) ^ Fintype.card (Option K × I) * ((Fintype.card (Option K × I) : ℝ) * probabilityProfileLipschitz) * δ ≤ 1 / 2) {ρ r β : ℝ} (hρ : 0 < ρ) (hr : 0 ≤ r) (hwidth : ∀ z, ρ * H z.2 ≤ V z) (hmove : (m : ℝ) * cubeModePolynomialBudget q L ≤ r * ρ * T) (hβ : 0 ≤ β) (hpower : ∀ i : Fin m, ζ ≤ β ^ (2 ^ (i.val + 1))) : ‖∑' z : Option K × I → ℤ, ((smoothProductPMF V hV z).toReal : ℂ) * layeredModeTestedPhase (fun j => affineModeLift (coefficientFunctional (fun d a => (frequency j d a : ℝ)))) p Q (fun s => affineSite root difference s) test (fun k j => (z (k, j) : ℝ))‖ ≤ 4 * (3 : ℝ) ^ Fintype.card (Option K × I) * ((Fintype.card (Option K × I) : ℝ) * probabilityProfileLipschitz) * r + β := by classical let B := finiteLayerBiasBudget m ζ let D := cubeModePolynomialBudget q L have hB : 1 ≤ B := finiteLayerBiasBudget_one_le m hζ have hD : 0 ≤ D := (cubeModePolynomialBudget_pos q hL).le have hA : 0 ≤ 2 * T := by positivity have hb (i : Fin m) : multiaffineBiasBudget i.val ζ ≤ B := multiaffineBiasBudget_le_finite i hζ obtain ⟨N, hN, hscale, hshift⟩ := exists_mode_shift_lengths m hT hB hρ hr hmove H stride hs hsize V hwidth have hbud (i : Fin m) := layerRemovalRankBudget_bounds i (Fintype.card I) hC hD (zero_le_one.trans hB) hA hS apply affine_cube_mode_smooth_removal U root difference hlin hL hC hsite frequency hbound hbad p hp hm N stride hs hζ (fun i k => (hb i).trans (hN k)) H hH hA hscale hrank (fun i => (hbud i).1.trans hR) _ _ Q hQ test htest V hV hV1 hδ hδ1 hmesh hsmall hr _ hβ hpower · intro i have hi := tensorDenominatorBound_le (H := Fin (i.val + 1)) (multiaffineBiasBudget_pos i.val hζ).le (fun k => (stride k : ℝ)) (fun k => Nat.cast_nonneg _) hstride have hi' : (∏ j : Fin (i.val + 1) → I, (multiaffineBiasBudget i.val ζ * ∏ r, (stride (j r) : ℝ))) ≤ (multiaffineBiasBudget i.val ζ * S ^ (i.val + 1)) ^ (Fintype.card I ^ (i.val + 1)) := by simpa only [Fintype.card_fin] using hi apply hi'.trans apply le_trans _ ((hbud i).2.1.trans hR) exact pow_le_pow_left₀ (mul_nonneg (multiaffineBiasBudget_pos i.val hζ).le (pow_nonneg hS _)) (mul_le_mul_of_nonneg_right (hb i) (pow_nonneg hS _)) _ · intro i apply le_trans _ ((hbud i).2.2.trans hR) exact mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left (hb i) (pow_nonneg hA _)) (pow_nonneg (Nat.cast_nonneg _) _) · intro i z have hi : ((i.val + 1 : ℕ) : ℝ) ≤ m := by exact_mod_cast Nat.succ_le_of_lt i.isLt apply le_trans _ (hshift z) exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hi hD) (mul_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _))
end Erdos3.BooleanCubeKernel
end
section
namespace Erdos3.BooleanCubeKernel
open VectorPolynomialopen scoped BigOperators
theorem affine_cube_removal_at_error {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {m q : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) (root : K → ℤ) (difference : Fin q → K → ℤ) (hlin : LinearIndependent ℝ (fun i k => (difference i k : ℝ))) {L C : ℝ} (hL : 0 ≤ L) (hC : 0 ≤ C) (hsite : ∀ (s : Finset (Fin q)) k, |((affineSite root difference s (some k) : ℤ) : ℝ)| ≤ L) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) (hbound : ∀ j d, d.degree ≤ j.val + 1 → ∀ a, |(frequency j d a : ℝ)| ≤ C) (hbad : ∃ i, ¬∃ M : (Finset (Fin q) → U i) →ₗ[ℝ] ℝ, ∀ P, Homogeneous (i.val + 1) P → affineModeLift (coefficientFunctional (fun d a => (frequency i d a : ℝ))) (map (U i).subtype P) = M (VectorPolynomial.siteEvaluation (fun s => affineSite (fun k => (root k : ℝ)) (fun r k => (difference r k : ℝ)) s) P)) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (hm : ∀ j d, coefficients (p j) d ∈ U j) (stride : I → ℕ) (hs : ∀ k, 0 < stride k) {R S ρ ε : ℝ} (hS : 0 ≤ S) (hρ : 0 < ρ) (hε : 0 < ε) (hstride : ∀ k, (stride k : ℝ) ≤ S) (H : I → ℝ) (hsize : ∀ k, modeRemovalSideThreshold m (Fintype.card (Option K × I)) (cubeModePolynomialBudget q L) S ρ ε ≤ H k) (hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (hR : modeRemovalRankThreshold m (Fintype.card I) (Fintype.card (Option K × I)) C (cubeModePolynomialBudget q L) S ρ ε ≤ R) (Q : MvPolynomial (Option K × I) ℝ) (hQ : Q.totalDegree ≤ 0) (test : Finset (Fin q) → (I → ℝ) → ℂ) (htest : ∀ t v, ‖test t v‖ ≤ 1) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (hwidth : ∀ z, ρ * H z.2 ≤ V z) : ‖∑' z : Option K × I → ℤ, ((smoothProductPMF V hV z).toReal : ℂ) * layeredModeTestedPhase (fun j => affineModeLift (coefficientFunctional (fun d a => (frequency j d a : ℝ)))) p Q (fun s => affineSite root difference s) test (fun k j => (z (k, j) : ℝ))‖ ≤ ε := by classical let d := Fintype.card (Option K × I) let D := cubeModePolynomialBudget q L let T := modeRemovalShrink m d D ρ ε let B := finiteLayerBiasBudget m (modeRemovalBias m ε) have hD : 0 ≤ D := (cubeModePolynomialBudget_pos q hL).le have hT : 0 < T := lt_of_lt_of_le zero_lt_one (modeRemovalShrink_one_le m d hD hρ hε) have hB : 1 ≤ B := finiteLayerBiasBudget_one_le m (modeRemovalBias_pos m hε) have hside := modeRemovalSideThreshold_bounds m d hD hS hρ hε have hH k : 0 < H k := hside.1.trans_le (hsize k) have hsize' k : (stride k : ℝ) * T * (B + 1) ≤ H k := by calc _ ≤ S * T * (B + 1) := by gcongr; exact hstride k _ ≤ H k := hside.2.1.trans (hsize k) have hv z : 1 ≤ V z ∧ 1 / V z ≤ modeRemovalMesh d := by apply modeRemovalMesh_of_width d (hV z) exact (hside.2.2.trans (mul_le_mul_of_nonneg_left (hsize z.2) hρ.le)).trans (hwidth z) have hout := affine_cube_removal_of_widths U root difference hlin hL hC hsite frequency hbound hbad p hp hm stride hs (modeRemovalBias_pos m hε) hT hS hstride H hH hsize' hrank hR Q hQ test htest V hV (fun z => (hv z).1) (modeRemovalMesh_pos d).le (modeRemovalMesh_le_one d) (fun z => (hv z).2) (modeRemovalMesh_small d) hρ (modeRemovalRadius_pos d hε).le hwidth (modeRemovalShrink_move m d hρ hε) (modeRemovalBeta_pos hε).le (fun i => modeRemovalBias_le i hε) exact hout.trans (modeRemovalError_bound d hε)
end Erdos3.BooleanCubeKernel
end
section
namespace Erdos3.BooleanCubeKernel
open VectorPolynomialopen scoped BigOperators
theorem exists_affine_cube_uniform_removal (m q : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {J : Fin m → Type*} [∀ j, Fintype (J j)] {P : ℝ} (_hP : 0 ≤ P) (_hn : (Fintype.card I : ℝ) ≤ P) (_hd : (Fintype.card (Option K × I) : ℝ) ≤ P) (U : ∀ j, Submodule ℝ (J j → ℝ)) (root : K → ℤ) (difference : Fin q → K → ℤ) (_hlin : LinearIndependent ℝ (fun i k => (difference i k : ℝ))) {L C : ℝ} (_hL : 0 ≤ L) (_hC : 0 ≤ C) (_hLP : L ≤ Real.exp P) (_hCP : C ≤ Real.exp P) (_hsite : ∀ (s : Finset (Fin q)) k, |((affineSite root difference s (some k) : ℤ) : ℝ)| ≤ L) (frequency : ∀ j, (K →₀ ℕ) → J j → ℤ) (_hbound : ∀ j d, d.degree ≤ j.val + 1 → ∀ a, |(frequency j d a : ℝ)| ≤ C) (_hbad : ∃ i, ¬∃ M : (Finset (Fin q) → U i) →ₗ[ℝ] ℝ, ∀ P, Homogeneous (i.val + 1) P → affineModeLift (coefficientFunctional (fun d a => (frequency i d a : ℝ))) (map (U i).subtype P) = M (VectorPolynomial.siteEvaluation (fun s => affineSite (fun k => (root k : ℝ)) (fun r k => (difference r k : ℝ)) s) P)) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (_hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (_hm : ∀ j d, coefficients (p j) d ∈ U j) (stride : I → ℕ) (_hs : ∀ k, 0 < stride k) {R S ρ ε : ℝ} (_hS : 0 ≤ S) (_hSP : S ≤ Real.exp P) (_hρ : 0 < ρ) (_hε : 0 < ε) (_hρP : 1 / ρ ≤ Real.exp P) (_hεP : 1 / ε ≤ Real.exp P) (_hstride : ∀ k, (stride k : ℝ) ≤ S) (H : I → ℝ) (_hsize : ∀ k, Real.exp ((P + A) ^ A) ≤ H k) (_hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (_hR : Real.exp ((P + A) ^ A) ≤ R) (Q : MvPolynomial (Option K × I) ℝ) (_hQ : Q.totalDegree ≤ 0) (test : Finset (Fin q) → (I → ℝ) → ℂ) (_htest : ∀ t v, ‖test t v‖ ≤ 1) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (_hwidth : ∀ z, ρ * H z.2 ≤ V z), ‖∑' z : Option K × I → ℤ, ((smoothProductPMF V hV z).toReal : ℂ) * layeredModeTestedPhase (fun j => affineModeLift (coefficientFunctional (fun d a => (frequency j d a : ℝ)))) p Q (fun s => affineSite root difference s) test (fun k j => (z (k, j) : ℝ))‖ ≤ ε := by obtain ⟨A, hA, hbudget⟩ := exists_cube_mode_threshold_exp_budget m q refine ⟨A, hA, ?_⟩ intro I K _ _ _ J _ P hP hn hd U root difference hlin L C hL hC hLP hCP hsite frequency hbound hbad p hp hm stride hs R S ρ ε hS hSP hρ hε hρP hεP hstride H hsize hrank hR Q hQ test htest V hV hwidth obtain ⟨hside, hrankBudget⟩ := hbudget (Fintype.card I) (Fintype.card (Option K × I)) P C L S ρ ε hP hn hd hC hCP hL hLP hS hSP hρ hρP hε hεP exact affine_cube_removal_at_error U root difference hlin hL hC hsite frequency hbound hbad p hp hm stride hs hS hρ hε hstride H (fun k => hside.trans (hsize k)) hrank (hrankBudget.trans hR) Q hQ test htest V hV hwidth
end Erdos3.BooleanCubeKernel
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142import Mathlib.Algebra.Order.Field.Basicimport Mathlib.Tactic
namespace OAI
section
namespace Erdos3
theorem affineInterval_normalized_bounds {L H step : ℕ} {start : ℤ} (hL : 0 < L) (hH : 2 ≤ H) (hstep : 0 < step) (hinside : ∀ t : Fin H, 0 ≤ start + step * (t.val : ℤ) ∧ start + step * (t.val : ℤ) < L) : 0 ≤ (start : ℝ) / L ∧ 0 < (step : ℝ) * ((H - 1 : ℕ) : ℝ) / L ∧ (start : ℝ) / L + (step : ℝ) * ((H - 1 : ℕ) : ℝ) / L < 1 ∧ (step : ℝ) * ((H - 1 : ℕ) : ℝ) / L ≤ 1 := by have hHpos : 0 < H := by omega have hlast : H - 1 < H := Nat.sub_lt hHpos (by norm_num) have hstartZ : 0 ≤ start := by simpa only [Nat.cast_zero, mul_zero, add_zero] using (hinside ⟨0, hHpos⟩).1 have hendZ := (hinside ⟨H - 1, hlast⟩).2 have hstart : (0 : ℝ) ≤ start := by exact_mod_cast hstartZ have hend : (start : ℝ) + (step : ℝ) * ((H - 1 : ℕ) : ℝ) < L := by exact_mod_cast hendZ have hLreal : (0 : ℝ) < L := by exact_mod_cast hL have hstepreal : (0 : ℝ) < step := by exact_mod_cast hstep have hHreal : (0 : ℝ) < ((H - 1 : ℕ) : ℝ) := by exact_mod_cast (show 0 < H - 1 by omega) have hlower := div_nonneg hstart hLreal.le have hwidth := div_pos (mul_pos hstepreal hHreal) hLreal have hsum : (start : ℝ) / L + (step : ℝ) * ((H - 1 : ℕ) : ℝ) / L < 1 := by rw [← add_div] exact (div_lt_one hLreal).mpr hend exact ⟨hlower, hwidth, hsum, by linarith⟩
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151import OAI.Combinatorics.Progressions.Estimates.DenseProgressionInnerFamilyimport OAI.Combinatorics.Progressions.Estimates.JointCoefficientRetainedTest
namespace OAI
section
namespace Erdos3
open MeasureTheoryopen scoped NNReal BigOperators
variable {J I : Type*} [Fintype J] [Fintype I]
def affineCubeTuple (lower width : J → ℝ) (x : J → Option I → ℝ) : J → Option I → ℝ := fun j i => (if i = none then lower j else 0) + width j * x j i
theorem affineCubeTuple_lipschitz (lower width : J → ℝ) (K : ℝ≥0) (hw : ∀ j, |width j| ≤ K) : LipschitzWith K (affineCubeTuple (I := I) lower width) := by apply LipschitzWith.of_dist_le_mul intro x y apply (dist_pi_le_iff (mul_nonneg K.coe_nonneg dist_nonneg)).mpr intro j apply (dist_pi_le_iff (mul_nonneg K.coe_nonneg dist_nonneg)).mpr intro i simp only [affineCubeTuple, dist_add_left, Real.dist_eq, ← mul_sub, abs_mul] simpa only [Real.dist_eq] using mul_le_mul (hw j) ((dist_le_pi_dist (x j) (y j) i).trans (dist_le_pi_dist x y j)) dist_nonneg K.coe_nonneg
theorem affineCubeTuple_width_dist (lower w v : J → ℝ) {ε : ℝ} (hε : 0 ≤ ε) (hw : ∀ j, |w j - v j| ≤ ε) (x : J → Option I → ℝ) (hx : ‖x‖ ≤ 1) : dist (affineCubeTuple lower w x) (affineCubeTuple lower v x) ≤ ε := by apply (dist_pi_le_iff hε).mpr intro j apply (dist_pi_le_iff hε).mpr intro i have hxj : |x j i| ≤ 1 := by exact (norm_le_pi_norm (x j) i).trans ((norm_le_pi_norm x j).trans hx) simp only [affineCubeTuple, dist_add_left, Real.dist_eq, ← sub_mul, abs_mul] exact (mul_le_mul (hw j) hxj (abs_nonneg _) hε).trans_eq (mul_one _)
theorem affineCubeTuple_integral_width_error [DecidableEq I] (lower w v : J → ℝ) {ε : ℝ} (hε : 0 ≤ ε) (hw : ∀ j, |w j - v j| ≤ ε) (φ : (J → Option I → ℝ) → ℝ) {K : ℝ≥0} {A : ℝ} (hφ : LipschitzWith K φ) (_hA : 0 ≤ A) (hb : ∀ x, ‖φ x‖ ≤ A) : |(∫ x, φ (affineCubeTuple lower w x) ∂scalarCubeProductMeasure J I) - ∫ x, φ (affineCubeTuple lower v x) ∂scalarCubeProductMeasure J I| ≤ K * ε := by have hm (v : J → ℝ) : Measurable (affineCubeTuple (I := I) lower v) := by unfold affineCubeTuple fun_prop have hi (v : J → ℝ) : Integrable (fun x => φ (affineCubeTuple lower v x)) (scalarCubeProductMeasure J I) := Integrable.mono' (integrable_const A) (hφ.continuous.measurable.comp (hm v)).aestronglyMeasurable (Filter.Eventually.of_forall (fun x => hb _)) rw [← integral_sub (hi w) (hi v)] have he : ∀ᵐ x ∂scalarCubeProductMeasure J I, ‖φ (affineCubeTuple lower w x) - φ (affineCubeTuple lower v x)‖ ≤ K * ε := by filter_upwards [scalarCubeProductMeasure_ae_closedBall J I] with x hx rw [Metric.mem_closedBall, dist_zero_right] at hx rw [← dist_eq_norm] exact (hφ.dist_le_mul _ _).trans (mul_le_mul_of_nonneg_left (affineCubeTuple_width_dist lower w v hε hw x hx) K.coe_nonneg) have ht := norm_integral_le_of_norm_le (integrable_const ((K : ℝ) * ε) (μ := scalarCubeProductMeasure J I)) he simpa only [Real.norm_eq_abs, integral_const, probReal_univ, one_smul] using ht
theorem affineCubeTuple_residue_riemann [DecidableEq J] [DecidableEq I] (H M : J → ℕ) (hH : ∀ j, 0 < H j) (modulus : J → Option I → ℕ) (residue : ∀ j i, ZMod (modulus j i)) (hm : ∀ j i, 0 < modulus j i) (hmM : ∀ j i, modulus j i ≤ M j) (hsize : ∀ j, (Fintype.card I + 1) * M j ≤ H j) (hsmall : ∀ j, scalarCubeGridBoundaryConstant I * ((M j : ℝ) / H j) < volume.real (scalarCubeDomain I)) (lower w v : J → ℝ) (W : ℝ≥0) (hw : ∀ j, |w j| ≤ W) {ε : ℝ} (hε : 0 ≤ ε) (hwidth : ∀ j, |w j - v j| ≤ ε) (φ : (J → Option I → ℝ) → ℝ) {K : ℝ≥0} {A : ℝ} (hφ : LipschitzWith K φ) (hA : 0 ≤ A) (hb : ∀ x, ‖φ x‖ ≤ A) : |(FiniteProbabilityWeights.pi (fun j => scalarCubeResidueWeights I (H j) (M j) (hH j) (modulus j) (residue j) (hm j) (hmM j) (hsize j))).mean (fun z => φ (affineCubeTuple lower w (fun j i => (z j i : ℝ) / H j))) - ∫ x, φ (affineCubeTuple lower v x) ∂scalarCubeProductMeasure J I| ≤ (2 * A * scalarCubeGridBoundaryConstant I / volume.real (scalarCubeDomain I) + K * W) * ∑ j, (M j : ℝ) / H j + K * ε := by have htest := hφ.comp (affineCubeTuple_lipschitz lower w W hw) have he := scalarCubeResidueWeights_pi_riemann H M hH modulus residue hm hmM hsize hsmall (φ ∘ affineCubeTuple lower w) htest hA (fun x => hb _) have hi := affineCubeTuple_integral_width_error lower w v hε hwidth φ hφ hA hb exact (abs_sub_le _ _ _).trans (add_le_add he hi)
end Erdos3
end
section
namespace Erdos3open scoped BigOperators NNReal Classicalvariable {G : Type*} [Fintype G]
noncomputable def affineKernelContinuousPoint (lower : G → ℝ) (step S : ℝ) (H : G → ℕ) (x : G → Option Empty → ℝ) : G → ℝ := fun g => (lower g + step * ((H g - 1 : ℕ) : ℝ) * x g none) / S
noncomputable def affineKernelDiscretePoint (lower : G → ℝ) (step S : ℝ) {H : G → ℕ} (z : ∀ g, IntegerScalarCubeBox Empty (H g)) : G → ℝ := fun g => (lower g + step * (z g none : ℝ)) / S
theorem affineKernelContinuousPoint_lipschitz (lower : G → ℝ) (step S : ℝ) (H : G → ℕ) (hS : 0 < S) (hstep : 0 ≤ step) (hspan : ∀ g, step * ((H g - 1 : ℕ) : ℝ) ≤ S) : LipschitzWith 1 (affineKernelContinuousPoint lower step S H) := by apply LipschitzWith.of_dist_le_mul intro x y simp only [NNReal.coe_one, one_mul] apply (dist_pi_le_iff dist_nonneg).mpr intro g have hw0 : 0 ≤ step * ((H g - 1 : ℕ) : ℝ) := mul_nonneg hstep (Nat.cast_nonneg _) have hw : step * ((H g - 1 : ℕ) : ℝ) / S ≤ 1 := (div_le_one hS).mpr (hspan g) have hx : |x g none - y g none| ≤ dist x y := (dist_le_pi_dist (x g) (y g) none).trans (dist_le_pi_dist x y g) change |(lower g + step * ((H g - 1 : ℕ) : ℝ) * x g none) / S - (lower g + step * ((H g - 1 : ℕ) : ℝ) * y g none) / S| ≤ _ rw [← sub_div, add_sub_add_left_eq_sub, ← mul_sub, abs_div, abs_mul, abs_of_nonneg hw0, abs_of_pos hS] calc _ = (step * ((H g - 1 : ℕ) : ℝ) / S) * |x g none - y g none| := by ring _ ≤ 1 * dist x y := mul_le_mul hw hx (abs_nonneg _) zero_le_one _ = _ := one_mul _
theorem affineKernelEndpoint_dist_le (lower : G → ℝ) (step S : ℝ) (H : G → ℕ) (hH : ∀ g, 0 < H g) (hS : 0 < S) (hstep : 0 ≤ step) (hspan : ∀ g, step * ((H g - 1 : ℕ) : ℝ) ≤ S) (z : ∀ g, IntegerScalarCubeBox Empty (H g)) (hz : (FiniteProbabilityWeights.pi (fun g => integerScalarCubeWeights Empty (H g) (hH g))).weight z ≠ 0) : dist (affineKernelDiscretePoint lower step S z) (affineKernelContinuousPoint lower step S H (fun g i => (z g i : ℝ) / H g)) ≤ ∑ g, (1 : ℝ) / H g := by have hsum : 0 ≤ ∑ g, (1 : ℝ) / H g := Finset.sum_nonneg (fun g _ => by positivity) apply (dist_pi_le_iff hsum).mpr intro g have hz' := integerScalarCubePi_root_real_bounds H hH z hz g have he := affineKernelEndpoint_error_nat (lower g) (hH g) hS hz'.1 hz'.2 hstep (hspan g) change |(lower g + step * (z g none : ℝ)) / S - (lower g + step * ((H g - 1 : ℕ) : ℝ) * ((z g none : ℝ) / H g)) / S| ≤ _ exact he.trans (Finset.single_le_sum (f := fun j => (1 : ℝ) / H j) (fun j _ => by positivity) (Finset.mem_univ g))
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324import Mathlib.MeasureTheory.Integral.Prodimport OAI.Combinatorics.Progressions.Lattices.OriginalKernelResidueRetained
namespace OAI
section
namespace Erdos3open MeasureTheoryopen scoped BigOperators Classical NNReal
theorem originalKernel_residue_slow_quadrature_varying {G : Type*} [Fintype G] [DecidableEq G] (L : G → ℕ) (q : ℕ) [NeZero q] (hL : ∀ g, 0 < L g) (hq : 0 < q) (hqL : ∀ g, q ≤ L g) (hsmall : ∀ g, scalarCubeGridBoundaryConstant Empty * ((q : ℝ) / L g) < volume.real (scalarCubeDomain Empty)) (F : (G → ZMod q) → (G → Option Empty → ℝ) → ℂ) {K : ℝ≥0} (hF : ∀ r, LipschitzWith K (F r)) (hbound : ∀ r x, ‖F r x‖ ≤ 1) : ‖(FiniteProbabilityWeights.pi (fun g : G => integerScalarCubeWeights Empty (L g) (hL g))).complexMean (fun z => F (fun g => ((z g none : ℤ) : ZMod q)) (fun g i => (z g i : ℝ) / L g)) - 𝔼 r : G → ZMod q, ∫ x, F r x ∂scalarCubeProductMeasure G Empty‖ ≤ (1 + 2 * (2 * scalarCubeGridBoundaryConstant Empty / volume.real (scalarCubeDomain Empty) + K)) * (∑ g, (q : ℝ) / L g) := by let test := fun (r : G → ZMod q) (z : ∀ g, IntegerScalarCubeBox Empty (L g)) => F r (fun g i => (z g i : ℝ) / L g) let law := fun (r : G → ZMod q) => FiniteProbabilityWeights.pi (fun g : G => scalarCubeResidueWeights Empty (L g) q (hL g) (fun _ => q) (fun _ => r g) (fun _ => hq) (fun _ => le_rfl) (by simpa using hqL g)) let e : ℝ := 2 * (2 * scalarCubeGridBoundaryConstant Empty / volume.real (scalarCubeDomain Empty) + K) * (∑ g, (q : ℝ) / L g) have hcond (r : G → ZMod q) : ‖(law r).complexMean (test r) - ∫ x, F r x ∂scalarCubeProductMeasure G Empty‖ ≤ e := by simpa only [law, test, e, Finset.sum_const, Finset.card_univ, nsmul_eq_mul, mul_one] using scalarCubeResidueWeights_pi_complex_riemann L (fun _ => q) hL (fun (_ : G) (_ : Option Empty) => q) (fun g _ => r g) (fun _ _ => hq) (fun _ _ => le_rfl) (fun g => by simpa using hqL g) hsmall (F r) (hF r) zero_le_one (hbound r) have hmix := integerScalarCubeWeights_empty_pi_uniform_residue_error_varying L q hL hq hqL test (fun r z => hbound r _) have havg : ‖(𝔼 r : G → ZMod q, (law r).complexMean (test r)) - 𝔼 r : G → ZMod q, ∫ x, F r x ∂scalarCubeProductMeasure G Empty‖ ≤ e := by rw [← Finset.expect_sub_distrib] apply (RCLike.norm_expect_le (K := ℂ)).trans exact (Finset.expect_le_expect (fun r _ => hcond r)).trans_eq (by simp) calc _ ≤ ‖(FiniteProbabilityWeights.pi (fun g : G => integerScalarCubeWeights Empty (L g) (hL g))).complexMean (fun z => test (fun g => ((z g none : ℤ) : ZMod q)) z) - 𝔼 r : G → ZMod q, (law r).complexMean (test r)‖ + ‖(𝔼 r : G → ZMod q, (law r).complexMean (test r)) - 𝔼 r : G → ZMod q, ∫ x, F r x ∂scalarCubeProductMeasure G Empty‖ := norm_sub_le_norm_sub_add_norm_sub _ _ _ _ ≤ (∑ g, (q : ℝ) / L g) + e := add_le_add hmix havg _ = _ := by dsimp only [e]; ring
end Erdos3
end
section
namespace Erdos3
open MeasureTheoryopen scoped BigOperators Classical NNReal
variable {G R : Type*} [Fintype G] [DecidableEq G]
theorem affineKernel_residue_slow_quadrature (H : G → ℕ) (q : ℕ) [NeZero q] (hH : ∀ g, 0 < H g) (hq : 0 < q) (hqH : ∀ g, q ≤ H g) (hsmall : ∀ g, scalarCubeGridBoundaryConstant Empty * ((q : ℝ) / H g) < volume.real (scalarCubeDomain Empty)) (lower : G → ℝ) (step S : ℝ) (hS : 0 < S) (hstep : 0 ≤ step) (hspan : ∀ g, step * ((H g - 1 : ℕ) : ℝ) ≤ S) (residueMap : (G → ZMod q) → R) (F : R → (G → ℝ) → ℂ) {K : ℝ≥0} (hF : ∀ r, LipschitzWith K (F r)) (hbound : ∀ r x, ‖F r x‖ ≤ 1) : ‖(FiniteProbabilityWeights.pi (fun g => integerScalarCubeWeights Empty (H g) (hH g))).complexMean (fun z => F (residueMap (fun g => ((z g none : ℤ) : ZMod q))) (fun g => (lower g + step * (z g none : ℝ)) / S)) - 𝔼 r : G → ZMod q, ∫ x, F (residueMap r) (affineKernelContinuousPoint lower step S H x) ∂scalarCubeProductMeasure G Empty‖ ≤ (1 + 2 * (2 * scalarCubeGridBoundaryConstant Empty / volume.real (scalarCubeDomain Empty) + K) + K) * ∑ g, (q : ℝ) / H g := by let p := FiniteProbabilityWeights.pi (fun g => integerScalarCubeWeights Empty (H g) (hH g)) let test := fun r x => F (residueMap r) (affineKernelContinuousPoint lower step S H x) have htest (r : G → ZMod q) : LipschitzWith K (test r) := by simpa only [test, Function.comp_def, mul_one] using (hF (residueMap r)).comp (affineKernelContinuousPoint_lipschitz lower step S H hS hstep hspan) have hquad := originalKernel_residue_slow_quadrature_varying H q hH hq hqH hsmall test htest (fun r x => hbound _ _) have hsum : (∑ g, (1 : ℝ) / H g) ≤ ∑ g, (q : ℝ) / H g := by apply Finset.sum_le_sum intro g _ exact div_le_div_of_nonneg_right (by exact_mod_cast hq) (by positivity) have hpoint : ‖p.complexMean (fun z => F (residueMap (fun g => ((z g none : ℤ) : ZMod q))) (fun g => (lower g + step * (z g none : ℝ)) / S)) - p.complexMean (fun z => test (fun g => ((z g none : ℤ) : ZMod q)) (fun g i => (z g i : ℝ) / H g))‖ ≤ (K : ℝ) * ∑ g, (q : ℝ) / H g := by apply (p.norm_complexMean_sub_le _ _ (fun _ => (K : ℝ) * ∑ g, (q : ℝ) / H g) ?_).trans_eq (p.mean_const _) intro z hz rw [← dist_eq_norm] exact ((hF _).dist_le_mul _ _).trans (mul_le_mul_of_nonneg_left ((affineKernelEndpoint_dist_le lower step S H hH hS hstep hspan z hz).trans hsum) K.coe_nonneg) exact (norm_sub_le_norm_sub_add_norm_sub _ _ _).trans ((add_le_add hpoint hquad).trans_eq (by ring))
theorem affineKernel_integer_residue_slow_quadrature (H : G → ℕ) (q : ℕ) [NeZero q] (hH : ∀ g, 0 < H g) (hq : 0 < q) (hqH : ∀ g, q ≤ H g) (hsmall : ∀ g, scalarCubeGridBoundaryConstant Empty * ((q : ℝ) / H g) < volume.real (scalarCubeDomain Empty)) (start : G → ℤ) (step : ℤ) (S : ℝ) (hS : 0 < S) (hstep : 0 ≤ step) (hspan : ∀ g, (step : ℝ) * ((H g - 1 : ℕ) : ℝ) ≤ S) (F : (G → ZMod q) → (G → ℝ) → ℂ) {K : ℝ≥0} (hF : ∀ r, LipschitzWith K (F r)) (hbound : ∀ r x, ‖F r x‖ ≤ 1) : ‖(FiniteProbabilityWeights.pi (fun g => integerScalarCubeWeights Empty (H g) (hH g))).complexMean (fun z => F (fun g => ((start g + step * (z g none : ℤ) : ℤ) : ZMod q)) (fun g => ((start g + step * (z g none : ℤ) : ℤ) : ℝ) / S)) - 𝔼 r : G → ZMod q, ∫ x, F (fun g => (start g : ZMod q) + (step : ZMod q) * r g) (fun g => ((start g : ℝ) + (step : ℝ) * ((H g - 1 : ℕ) : ℝ) * x g none) / S) ∂scalarCubeProductMeasure G Empty‖ ≤ (1 + 2 * (2 * scalarCubeGridBoundaryConstant Empty / volume.real (scalarCubeDomain Empty) + K) + K) * ∑ g, (q : ℝ) / H g := by have h := affineKernel_residue_slow_quadrature H q hH hq hqH hsmall (fun g => (start g : ℝ)) (step : ℝ) S hS (by exact_mod_cast hstep) hspan (fun r g => (start g : ZMod q) + (step : ZMod q) * r g) F hF hbound simp only [Int.cast_add, Int.cast_mul] at ⊢ convert h using 1 rfl
omit [Fintype G] [DecidableEq G] in
theorem affineKernel_span_of_contained (H : G → ℕ) (hH : ∀ g, 0 < H g) (start : G → ℤ) (step S : ℕ) (hstep : 0 < step) (hcontained : ∀ g, integerProgressionSupport (start g) (step : ℤ) (H g) ⊆ Finset.Ico (0 : ℤ) (S : ℤ)) : ∀ g, (step : ℝ) * ((H g - 1 : ℕ) : ℝ) ≤ S := by intro g have hfirst := hcontained g (integerProgressionSupport_point (start g) step (H g) hstep 0 (hH g)) have hlast := hcontained g (integerProgressionSupport_point (start g) step (H g) hstep (H g - 1) (by have := hH g omega)) have hc : (0 : ℤ) ≤ start g := by simpa using (Finset.mem_Ico.mp hfirst).1 have he : start g + (step : ℤ) * ((H g - 1 : ℕ) : ℤ) < S := (Finset.mem_Ico.mp hlast).2 have hs : (step : ℤ) * ((H g - 1 : ℕ) : ℤ) ≤ S := by omega exact_mod_cast hs
end Erdos3
end
section
namespace Erdos3
open MeasureTheoryopen scoped BigOperators Classical NNReal
theorem originalKernel_residue_slow_retained_quadrature_varying {G Z : Type*} [Fintype G] [DecidableEq G] [MeasurableSpace Z] (μ : Measure Z) [IsProbabilityMeasure μ] (L : G → ℕ) (q : ℕ) [NeZero q] (hL : ∀ g, 0 < L g) (hq : 0 < q) (hqL : ∀ g, q ≤ L g) (hsmall : ∀ g, scalarCubeGridBoundaryConstant Empty * ((q : ℝ) / L g) < volume.real (scalarCubeDomain Empty)) (F : Z → (G → ZMod q) → (G → Option Empty → ℝ) → ℂ) (hMeas : ∀ r, Measurable (fun zx : Z × (G → Option Empty → ℝ) => F zx.1 r zx.2)) {K : ℝ≥0} (hLip : ∀ z r, LipschitzWith K (F z r)) (hbound : ∀ z r x, ‖F z r x‖ ≤ 1) : ‖(∫ z, (FiniteProbabilityWeights.pi (fun g : G => integerScalarCubeWeights Empty (L g) (hL g))).complexMean (fun y => F z (fun g => ((y g none : ℤ) : ZMod q)) (fun g i => (y g i : ℝ) / L g)) ∂μ) - ∫ z, 𝔼 r : G → ZMod q, ∫ x, F z r x ∂scalarCubeProductMeasure G Empty ∂μ‖ ≤ (1 + 2 * (2 * scalarCubeGridBoundaryConstant Empty / volume.real (scalarCubeDomain Empty) + K)) * (∑ g, (q : ℝ) / L g) := by let p := FiniteProbabilityWeights.pi (fun g : G => integerScalarCubeWeights Empty (L g) (hL g)) let a (z : Z) := p.complexMean (fun y => F z (fun g => ((y g none : ℤ) : ZMod q)) (fun g i => (y g i : ℝ) / L g)) let b (z : Z) := 𝔼 r : G → ZMod q, ∫ x, F z r x ∂scalarCubeProductMeasure G Empty have haMeas : Measurable a := by unfold a FiniteProbabilityWeights.complexMean apply Finset.measurable_sum intro y _ exact measurable_const.mul ((hMeas _).comp (measurable_id.prodMk measurable_const)) have haBound (z : Z) : ‖a z‖ ≤ 1 := by apply (p.norm_complexMean_le_mean_norm _).trans exact (p.mean_mono (fun y => hbound z _ _)).trans_eq (p.mean_const 1) have haInt : Integrable a μ := (integrable_const (1 : ℝ)).mono' haMeas.aestronglyMeasurable (ae_of_all μ haBound) have hiMeas (r : G → ZMod q) : StronglyMeasurable (fun z => ∫ x, F z r x ∂scalarCubeProductMeasure G Empty) := (hMeas r).stronglyMeasurable.integral_prod_right' have hiBound (z : Z) (r : G → ZMod q) : ‖∫ x, F z r x ∂scalarCubeProductMeasure G Empty‖ ≤ 1 := by simpa only [probReal_univ, mul_one] using norm_integral_le_of_norm_le_const (ae_of_all (scalarCubeProductMeasure G Empty) (hbound z r)) have hbMeas : Measurable b := by unfold b simp only [Fintype.expect_eq_sum_div_card] apply Measurable.div_const exact Finset.measurable_sum _ (fun r _ => (hiMeas r).measurable) have hbBound (z : Z) : ‖b z‖ ≤ 1 := by apply (RCLike.norm_expect_le (K := ℂ)).trans exact (Finset.expect_le_expect (fun r _ => hiBound z r)).trans_eq (by simp) have hbInt : Integrable b μ := (integrable_const (1 : ℝ)).mono' hbMeas.aestronglyMeasurable (ae_of_all μ hbBound) change ‖(∫ z, a z ∂μ) - ∫ z, b z ∂μ‖ ≤ _ rw [← integral_sub haInt hbInt] have he := ae_of_all μ (fun z => originalKernel_residue_slow_quadrature_varying L q hL hq hqL hsmall (F z) (hLip z) (hbound z)) simpa only [probReal_univ, mul_one] using norm_integral_le_of_norm_le_const he
end Erdos3
end
section
namespace Erdos3
open MeasureTheoryopen scoped BigOperators Classical NNReal
theorem affineKernel_residue_slow_retained_quadrature {G R Z : Type*} [Fintype G] [DecidableEq G] [MeasurableSpace Z] (μ : Measure Z) [IsProbabilityMeasure μ] (H : G → ℕ) (q : ℕ) [NeZero q] (hH : ∀ g, 0 < H g) (hq : 0 < q) (hqH : ∀ g, q ≤ H g) (hsmall : ∀ g, scalarCubeGridBoundaryConstant Empty * ((q : ℝ) / H g) < volume.real (scalarCubeDomain Empty)) (lower : G → ℝ) (step S : ℝ) (hS : 0 < S) (hstep : 0 ≤ step) (hspan : ∀ g, step * ((H g - 1 : ℕ) : ℝ) ≤ S) (residueMap : (G → ZMod q) → R) (F : Z → R → (G → ℝ) → ℂ) (hMeas : ∀ r, Measurable (fun zx : Z × (G → ℝ) => F zx.1 r zx.2)) {K : ℝ≥0} (hLip : ∀ z r, LipschitzWith K (F z r)) (hbound : ∀ z r x, ‖F z r x‖ ≤ 1) : ‖(∫ z, (FiniteProbabilityWeights.pi (fun g => integerScalarCubeWeights Empty (H g) (hH g))).complexMean (fun y => F z (residueMap (fun g => ((y g none : ℤ) : ZMod q))) (fun g => (lower g + step * (y g none : ℝ)) / S)) ∂μ) - ∫ z, 𝔼 r : G → ZMod q, ∫ x, F z (residueMap r) (affineKernelContinuousPoint lower step S H x) ∂scalarCubeProductMeasure G Empty ∂μ‖ ≤ (1 + 2 * (2 * scalarCubeGridBoundaryConstant Empty / volume.real (scalarCubeDomain Empty) + K) + K) * ∑ g, (q : ℝ) / H g := by let p := FiniteProbabilityWeights.pi (fun g => integerScalarCubeWeights Empty (H g) (hH g)) let a (z : Z) := p.complexMean (fun y => F z (residueMap (fun g => ((y g none : ℤ) : ZMod q))) (fun g => (lower g + step * (y g none : ℝ)) / S)) let b (z : Z) := 𝔼 r : G → ZMod q, ∫ x, F z (residueMap r) (affineKernelContinuousPoint lower step S H x) ∂scalarCubeProductMeasure G Empty have haMeas : Measurable a := by unfold a FiniteProbabilityWeights.complexMean apply Finset.measurable_sum intro y _ exact measurable_const.mul ((hMeas _).comp (measurable_id.prodMk measurable_const)) have haBound (z : Z) : ‖a z‖ ≤ 1 := by apply (p.norm_complexMean_le_mean_norm _).trans exact (p.mean_mono (fun y => hbound z _ _)).trans_eq (p.mean_const 1) have haInt : Integrable a μ := (integrable_const (1 : ℝ)).mono' haMeas.aestronglyMeasurable (ae_of_all μ haBound) have hAffine : Measurable (affineKernelContinuousPoint lower step S H) := (affineKernelContinuousPoint_lipschitz lower step S H hS hstep hspan).continuous.measurable have hiMeas (r : G → ZMod q) : StronglyMeasurable (fun z => ∫ x, F z (residueMap r) (affineKernelContinuousPoint lower step S H x) ∂scalarCubeProductMeasure G Empty) := by have hm : Measurable (fun zx : Z × (G → Option Empty → ℝ) => F zx.1 (residueMap r) (affineKernelContinuousPoint lower step S H zx.2)) := (hMeas _).comp (measurable_fst.prodMk (hAffine.comp measurable_snd)) exact hm.stronglyMeasurable.integral_prod_right' have hiBound (z : Z) (r : G → ZMod q) : ‖∫ x, F z (residueMap r) (affineKernelContinuousPoint lower step S H x) ∂scalarCubeProductMeasure G Empty‖ ≤ 1 := by simpa only [probReal_univ, mul_one] using norm_integral_le_of_norm_le_const (ae_of_all (scalarCubeProductMeasure G Empty) (fun x => hbound z _ _)) have hbMeas : Measurable b := by unfold b simp only [Fintype.expect_eq_sum_div_card] apply Measurable.div_const exact Finset.measurable_sum _ (fun r _ => (hiMeas r).measurable) have hbBound (z : Z) : ‖b z‖ ≤ 1 := by apply (RCLike.norm_expect_le (K := ℂ)).trans exact (Finset.expect_le_expect (fun r _ => hiBound z r)).trans_eq (by simp) have hbInt : Integrable b μ := (integrable_const (1 : ℝ)).mono' hbMeas.aestronglyMeasurable (ae_of_all μ hbBound) change ‖(∫ z, a z ∂μ) - ∫ z, b z ∂μ‖ ≤ _ rw [← integral_sub haInt hbInt] have he := ae_of_all μ (fun z => affineKernel_residue_slow_quadrature H q hH hq hqH hsmall lower step S hS hstep hspan residueMap (F z) (hLip z) (hbound z)) simpa only [probReal_univ, mul_one] using norm_integral_le_of_norm_le_const he
end Erdos3
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253import OAI.Combinatorics.Progressions.Estimates.SubspaceLayeredModeSmoothRemoval
namespace OAI
section
namespace Erdos3.VectorPolynomial
noncomputable def liftedIntegerSite {K : Type*} (site : K → ℤ) : Option K → ℤ := fun k => k.elim 1 site
theorem liftedIntegerSite_cast {K : Type*} (site : K → ℤ) : (fun k => (liftedIntegerSite site k : ℝ)) = (fun k : Option K => k.elim 1 (fun k => (site k : ℝ))) := by funext k cases k <;> simp [liftedIntegerSite]
theorem exists_affine_layered_mode_reduction {I K S : Type*} [Fintype K] [Fintype S] [DecidableEq S] {m : ℕ} {W : Fin m → Type*} [∀ j, AddCommGroup (W j)] [∀ j, Module ℝ (W j)] (site : S → K → ℤ) (L : ∀ j, VectorPolynomial K ℝ (W j) →ₗ[ℝ] ℝ) (p : ∀ j, VectorPolynomial I ℝ (W j)) (hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (hbad : ∃ i, ¬∃ M : (S → W i) →ₗ[ℝ] ℝ, ∀ q, Homogeneous (i.val + 1) q → affineModeLift (L i) q = M (siteEvaluation (fun s (k : Option K) => k.elim 1 (fun k => (site s k : ℝ))) q)) (Q : MvPolynomial (Option K × I) ℝ) (hQ : Q.totalDegree ≤ 0) (test : S → (I → ℝ) → ℂ) (htest : ∀ s x, ‖test s x‖ ≤ 1) : ∃ i, (¬∃ M : (S → W i) →ₗ[ℝ] ℝ, ∀ q, Homogeneous (i.val + 1) q → affineModeLift (L i) q = M (siteEvaluation (fun s (k : Option K) => k.elim 1 (fun k => (site s k : ℝ))) q)) ∧ ∃ Q' : MvPolynomial (Option K × I) ℝ, Q'.totalDegree < i.val + 1 ∧ ∃ test' : S → (I → ℝ) → ℂ, (∀ s x, ‖test' s x‖ ≤ 1) ∧ ∀ b, layeredModeTestedPhase (fun j => affineModeLift (L j)) p Q (fun s => liftedIntegerSite (site s)) test b = coefficientModeTestedPhase (affineModeLift (L i)) (p i) Q' (fun s => liftedIntegerSite (site s)) test' b := by obtain ⟨i, hi, hh⟩ := exists_highest_affine_nonfactor (fun s k => (site s k : ℝ)) L hbad refine ⟨i, hi, ?_⟩ apply exists_layered_mode_reduction i (fun j => affineModeLift (L j)) p hp (fun s => liftedIntegerSite (site s)) _ Q (hQ.trans_lt (Nat.zero_lt_succ _)) test htest have hs : (fun s k => (liftedIntegerSite (site s) k : ℝ)) = (fun s (k : Option K) => k.elim 1 (fun k => (site s k : ℝ))) := by funext s k exact congrFun (liftedIntegerSite_cast (site s)) k rw [hs] exact hh
end Erdos3.VectorPolynomial
end
end OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394import OAI.Combinatorics.Progressions.Polynomial.CRTPolynomialPatchComposition
namespace OAI
section
namespace Erdos3
open MvPolynomial
variable {σ ρ : Type*} {D E s : ℕ}
noncomputable def affineLiftSubstitution (c : ρ → ℝ) (M : ρ → Fin D → ℝ) : σ ⊕ ρ → MvPolynomial (σ ⊕ Fin D) ℝ := Sum.elim (fun a => X (Sum.inl a)) (fun a => C (c a) + ∑ j, M a j • X (Sum.inr j))
theorem affineLiftSubstitution_degree {p : ρ → ℕ} {w : Fin D → ℕ} (c : ρ → ℝ) (M : ρ → Fin D → ℝ) (hM : ∀ a j, M a j ≠ 0 → w j ≤ p a) (a : σ ⊕ ρ) : affineLiftSubstitution c M a ∈ weightedSupportLE (Sum.elim (fun _ : σ => 1) w) (Sum.elim (fun _ : σ => 1) p a) := by classical cases a with | inl a => exact weightedSupportLE_X _ (Sum.inl a) | inr a => apply (weightedSupportLE _ _).add_mem (weightedSupportLE_C _ _ _) apply (weightedSupportLE _ _).sum_mem intro j _ by_cases hj : M a j = 0 · simp only [hj, zero_smul] exact (weightedSupportLE _ _).zero_mem · exact weightedSupportLE_mono (hM a j hj) ((weightedSupportLE _ _).smul_mem (M a j) (weightedSupportLE_X (Sum.elim (fun _ : σ => 1) w) (Sum.inr j)))
theorem affineLiftSubstitution_eval (c : ρ → ℝ) (M : ρ → Fin D → ℝ) (t : σ → ℝ) (x : Fin D → ℝ) (a : σ ⊕ ρ) : aeval (Sum.elim t x) (affineLiftSubstitution c M a) = Sum.elim t (fun a => c a + ∑ j, M a j * x j) a := by cases a <;> simp [affineLiftSubstitution]
namespace PolynomialPatch
noncomputable def insertAffineLifts {p : ρ → ℕ} (A : PolynomialPatch σ s D) (B : WeightedParameterPatch (σ ⊕ ρ) (Sum.elim (fun _ => 1) p) s E) (c : ρ → ℝ) (M : ρ → Fin D → ℝ) (hM : ∀ a j, M a j ≠ 0 → A.weight j ≤ p a) : PolynomialPatch σ s (D + E) := A.insertLifts (B.reparam (affineLiftSubstitution c M) (affineLiftSubstitution_degree c M hM))
@[simp] theorem insertAffineLifts_lip {p : ρ → ℕ} (A : PolynomialPatch σ s D) (B : WeightedParameterPatch (σ ⊕ ρ) (Sum.elim (fun _ => 1) p) s E) (c : ρ → ℝ) (M : ρ → Fin D → ℝ) (hM : ∀ a j, M a j ≠ 0 → A.weight j ≤ p a) : (A.insertAffineLifts B c M hM).kernel.lip = A.kernel.lip + B.kernel.lip := rfl
theorem insertAffineLifts_value_at_lift {p : ρ → ℕ} (A : PolynomialPatch σ s D) (B : WeightedParameterPatch (σ ⊕ ρ) (Sum.elim (fun _ => 1) p) s E) (c : ρ → ℝ) (M : ρ → Fin D → ℝ) (hM : ∀ a j, M a j ≠ 0 → A.weight j ≤ p a) (t : σ → ℝ) (b : Fin D → ℤ) (hb : ∀ i, |(A.form.slots t).residual b i| ≤ 1 / 3) : (A.insertAffineLifts B c M hM).value t = A.kernel.value ((A.form.slots t).residual b) * B.value (Sum.elim t (fun a => c a + ∑ j, M a j * (b j : ℝ))) := by unfold insertAffineLifts rw [insertLifts_value_at_lift _ _ t b hb, WeightedParameterPatch.reparam_value] simp only [affineLiftSubstitution_eval]
theorem exists_affine_lift_insertion {p : ρ → ℕ} (w : Fin D → ℕ) (hw : ∀ i, 1 ≤ w i) (hws : ∀ i, w i ≤ s) (hmono : Monotone w) (P : Fin D → MvPolynomial σ ℝ) (hP : ∀ i, P i ∈ weightedSupportLE (fun _ : σ => 1) (w i)) (Φ : PatchKernel D) (B : WeightedParameterPatch (σ ⊕ ρ) (Sum.elim (fun _ => 1) p) s E) (c : ρ → ℝ) (M : ρ → Fin D → ℝ) (hM : ∀ a j, M a j ≠ 0 → w j ≤ p a) : ∃ Q : PolynomialPatch σ s (D + E), Q.kernel.lip = Φ.lip + B.kernel.lip ∧ ∀ (t : σ → ℝ) (b : Fin D → ℤ), (∀ i, |(b i : ℝ) - aeval t (P i)| ≤ 1 / 3) → Q.value t = Φ.value (fun i => (b i : ℝ) - aeval t (P i)) * B.value (Sum.elim t (fun a => c a + ∑ j, M a j * (b j : ℝ))) := by let A := ofCoordinates w hw hws hmono P hP Φ refine ⟨A.insertAffineLifts B c M hM, rfl, ?_⟩ intro t b hb have hres : (A.form.slots t).residual b = fun i => (b i : ℝ) - aeval t (P i) := ofCoordinates_residual w hw hws hmono P hP Φ t b rw [insertAffineLifts_value_at_lift A B c M hM t b (by simpa only [hres] using hb), hres] rfl
end PolynomialPatchend Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384import OAI.Combinatorics.Progressions.Estimates.DependentPatchValue
namespace OAI
section
namespace Erdos3
namespace TriangularSlots
variable {D : ℕ}
noncomputable def affineBlock (M : Matrix (Fin D) (Fin D) ℝ) (hM : ∀ i j, i ≤ j → M i j = 0) (P : Fin D → ℝ) : TriangularSlots D where center x := P + M.mulVec (x - P) lower i x y hxy := by simp only [Pi.add_apply, Matrix.mulVec, dotProduct] congr 1 apply Finset.sum_congr rfl intro j _ by_cases hji : j < i · simp only [Pi.sub_apply, hxy j hji] · simp [hM i j (le_of_not_gt hji)]
theorem affineBlock_residual (M : Matrix (Fin D) (Fin D) ℝ) (hM : ∀ i j, i ≤ j → M i j = 0) (P : Fin D → ℝ) (b : Fin D → ℤ) : (affineBlock M hM P).residual b = (1 - M).mulVec ((fun i => (b i : ℝ)) - P) := by rw [Matrix.sub_mulVec, Matrix.one_mulVec] ext i simp only [residual, affineBlock, Pi.sub_apply, Pi.add_apply] ring
end TriangularSlots
def shiftedIntegerBlock {T : Type*} {D : ℕ} (I : T → Fin D → ℤ) (t₀ : T) (b₀ : Fin D → ℤ) (t : T) : Fin D → ℤ := b₀ + I t - I t₀
@[simp] theorem shiftedIntegerBlock_at_base {T : Type*} {D : ℕ} (I : T → Fin D → ℤ) (t₀ : T) (b₀ : Fin D → ℤ) : shiftedIntegerBlock I t₀ b₀ t₀ = b₀ := by simp [shiftedIntegerBlock]
theorem affine_residual_shift_identity {T : Type*} {D : ℕ} (M : Matrix (Fin D) (Fin D) ℝ) (hM : ∀ i j, i ≤ j → M i j = 0) (P : T → Fin D → ℝ) (I : T → Fin D → ℤ) (t₀ t : T) (b₀ : Fin D → ℤ) : (TriangularSlots.affineBlock M hM (P t)).residual (shiftedIntegerBlock I t₀ b₀ t) - (TriangularSlots.affineBlock M hM (P t₀)).residual b₀ = -(1 - M).mulVec ((P t - fun i => (I t i : ℝ)) - (P t₀ - fun i => (I t₀ i : ℝ))) := by rw [TriangularSlots.affineBlock_residual, TriangularSlots.affineBlock_residual, ← Matrix.mulVec_sub, ← Matrix.mulVec_neg] congr 1 ext i simp only [shiftedIntegerBlock, Pi.add_apply, Pi.sub_apply, Pi.neg_apply, Int.cast_sub, Int.cast_add] ring
theorem affine_residual_shift_dist {T : Type*} {D : ℕ} (M : Matrix (Fin D) (Fin D) ℝ) (hM : ∀ i j, i ≤ j → M i j = 0) (P : T → Fin D → ℝ) (I : T → Fin D → ℤ) (t₀ t : T) (b₀ : Fin D → ℤ) : dist ((TriangularSlots.affineBlock M hM (P t)).residual (shiftedIntegerBlock I t₀ b₀ t)) ((TriangularSlots.affineBlock M hM (P t₀)).residual b₀) = ‖(1 - M).mulVec ((P t - fun i => (I t i : ℝ)) - (P t₀ - fun i => (I t₀ i : ℝ)))‖ := by rw [dist_eq_norm, affine_residual_shift_identity, norm_neg]
theorem freeze_affine_lowest_layer {T : Type*} {D E : ℕ} (M : Matrix (Fin D) (Fin D) ℝ) (hM : ∀ i j, i ≤ j → M i j = 0) (P : T → Fin D → ℝ) (I : T → Fin D → ℤ) (B : T → (Fin D → ℝ) → TriangularSlots E) (Φ : PatchKernel (D + E)) (t₀ : T) (b₀ : Fin D → ℤ) {ε : ℝ} (hbase : ∀ i, |(TriangularSlots.affineBlock M hM (P t₀)).residual b₀ i| ≤ 1 / 4) (hε : ε < 1 / 12) (hosc : ∀ t, ‖(1 - M).mulVec ((P t - fun i => (I t i : ℝ)) - (P t₀ - fun i => (I t₀ i : ℝ)))‖ ≤ ε) : ∀ t, dist (((TriangularSlots.affineBlock M hM (P t)).append (B t)).patchValue Φ) ((B t (fun i => (shiftedIntegerBlock I t₀ b₀ t i : ℝ))).patchValue (Φ.freeze ((TriangularSlots.affineBlock M hM (P t₀)).residual b₀))) ≤ Φ.lip * ε := by intro t apply TriangularSlots.patchValue_freeze_prefix _ _ Φ _ _ hbase hε rw [affine_residual_shift_dist] exact hosc t
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548import OAI.Combinatorics.Progressions.Dynamics.InitialConditioningBudgetimport OAI.Combinatorics.Progressions.Geometry.OutsideProductTransportimport OAI.Combinatorics.Progressions.Lattices.ResidueCellNormLengthsimport OAI.Combinatorics.Progressions.Lattices.RetainedPhysicalCRT
namespace OAI
section
namespace Erdos3
open scoped BigOperators Classical
variable {ι σ : Type*} [Fintype ι] [DecidableEq ι] [Fintype σ] [DecidableEq σ] (lo : σ → ℤ) (N : σ → ℕ) (M : ℕ) (a : σ → ℤ) (hne : Nonempty (IntegerResidueBox lo (fun k => lo k + N k) (fun _ => (M : ℤ)) a)) (q : ι → ℕ) [∀ i, NeZero (q i)] (hpair : Pairwise (fun i k => (q i).Coprime (q k))) (K : Finset ι) (base : ∀ i, σ → ZMod (q i)) (u : ResiduePrimeCoordinateCell lo N M a q K base)
include hpair u
theorem residuePrimeCoordinateDensity_fixed (f : (σ → ℤ) → ℝ) (x : ∀ i, σ → ZMod (q i)) (hx : ∀ i ∈ K, x i = base i) : residuePrimeCoordinateDensity lo N M a hne q f x = residuePrimeCoordinateMassRatio lo N M a q K base * residueCellOutsideDensity lo N M a q K base u f (fun i => x i.val) := by have hcover : K ∪ (Finset.univ : Finset {i // i ∉ K}).image Subtype.val = Finset.univ := by ext i by_cases hi : i ∈ K · simp [hi] · simp only [Finset.mem_union, hi, false_or, Finset.mem_image, Finset.mem_univ, iff_true] exact ⟨⟨i, hi⟩, trivial, rfl⟩ have h := residuePrimeCoordinateDensity_conditional_outside lo N M a hne q hpair K base u f (Finset.univ : Finset {i // i ∉ K}) x hx rw [hcover, productConditionalMean_univ, productConditionalMean_univ] at h rw [residueCellOutsideDensity_lcm lo N M a q hpair K base u f] exact h
theorem residuePrimeCoordinateDensity_section (f : (σ → ℤ) → ℝ) (x : ∀ i, σ → ZMod (q i)) : productSectionAverage (primeCoordinateReference (σ := σ) q) K K base (residuePrimeCoordinateDensity lo N M a hne q f) x = residuePrimeCoordinateMassRatio lo N M a q K base * residueCellOutsideDensity lo N M a q K base u f (fun i => x i.val) := by have hx : ∀ i ∈ K, productCoordinateMix K base x i = base i := by intro i hi simp only [productCoordinateMix, hi, ite_true] have hout : (fun i : {i // i ∉ K} => productCoordinateMix K base x i.val) = (fun i : {i // i ∉ K} => x i.val) := by funext i simp only [productCoordinateMix, i.property, ite_false] rw [productSectionAverage_eq_conditionalMean _ K K (Finset.Subset.refl K)] simp only [Finset.union_compl, productConditionalMean_univ] rw [residuePrimeCoordinateDensity_fixed lo N M a hne q hpair K base u f _ hx, hout]
omit hne hpair intheorem residuePrimeCoordinateMassRatio_pos : 0 < residuePrimeCoordinateMassRatio lo N M a q K base := by let : Nonempty (ResiduePrimeCoordinateCell lo N M a q K base) := ⟨u⟩ let : Nonempty (IntegerResidueBox lo (fun k => lo k + N k) (fun _ => (M : ℤ)) a) := ⟨u.val⟩ have hp : 0 < ∏ i ∈ K, q i := Finset.prod_pos (fun i _ => Nat.pos_of_ne_zero (NeZero.ne (q i))) rw [residuePrimeCoordinateMassRatio_eq_count] positivity
theorem residuePrimeCoordinateDensity_normalized_section (f : (σ → ℤ) → ℝ) (x : ∀ i, σ → ZMod (q i)) : (residuePrimeCoordinateMassRatio lo N M a q K base)⁻¹ * productSectionAverage (primeCoordinateReference (σ := σ) q) K K base (residuePrimeCoordinateDensity lo N M a hne q f) x = residueCellOutsideDensity lo N M a q K base u f (fun i => x i.val) := by rw [residuePrimeCoordinateDensity_section lo N M a hne q hpair K base u f x, ← mul_assoc, inv_mul_cancel₀ (residuePrimeCoordinateMassRatio_pos lo N M a q K base u).ne', one_mul]
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
theorem residuePrimeCoordinateMassRatio_le_prime_product {ι σ : Type*} [Fintype ι] [DecidableEq ι] [Fintype σ] [DecidableEq σ] (lo : σ → ℤ) (N : σ → ℕ) (M : ℕ) (a : σ → ℤ) (q : ι → ℕ) [∀ i, NeZero (q i)] (K : Finset ι) (base : ∀ i, σ → ZMod (q i)) (u : ResiduePrimeCoordinateCell lo N M a q K base) : residuePrimeCoordinateMassRatio lo N M a q K base ≤ ((∏ i ∈ K, q i : ℕ) : ℝ) ^ Fintype.card σ := by let : Nonempty (IntegerResidueBox lo (fun k => lo k + N k) (fun _ => (M : ℤ)) a) := ⟨u.val⟩ have hB : (0 : ℝ) < Fintype.card (IntegerResidueBox lo (fun k => lo k + N k) (fun _ => (M : ℤ)) a) := by exact_mod_cast Fintype.card_pos have hcard : (Fintype.card (ResiduePrimeCoordinateCell lo N M a q K base) : ℝ) ≤ Fintype.card (IntegerResidueBox lo (fun k => lo k + N k) (fun _ => (M : ℤ)) a) := Nat.cast_le.mpr (Fintype.card_subtype_le _) have hratio : (Fintype.card (ResiduePrimeCoordinateCell lo N M a q K base) : ℝ) / Fintype.card (IntegerResidueBox lo (fun k => lo k + N k) (fun _ => (M : ℤ)) a) ≤ 1 := by apply (div_le_iff₀ hB).mpr simpa only [one_mul] using hcard rw [residuePrimeCoordinateMassRatio_eq_count, mul_div_assoc] exact mul_le_of_le_one_right (by positivity) hratio
theorem residuePrimeCoordinateMassRatio_le_exp {ι σ : Type*} [Fintype ι] [DecidableEq ι] [Fintype σ] [DecidableEq σ] (lo : σ → ℤ) (N : σ → ℕ) (M : ℕ) (a : σ → ℤ) (q : ι → ℕ) [∀ i, NeZero (q i)] (K : Finset ι) (base : ∀ i, σ → ZMod (q i)) (u : ResiduePrimeCoordinateCell lo N M a q K base) (modLog : ℝ) (hmoduli : ∀ i, (q i : ℝ) ≤ Real.exp modLog) : residuePrimeCoordinateMassRatio lo N M a q K base ≤ Real.exp ((K.card : ℝ) * Fintype.card σ * modLog) := by have hprod := primeCoordinateProduct_le_exp q K modLog hmoduli calc _ ≤ ((∏ i ∈ K, q i : ℕ) : ℝ) ^ Fintype.card σ := residuePrimeCoordinateMassRatio_le_prime_product lo N M a q K base u _ ≤ (Real.exp (modLog * K.card)) ^ Fintype.card σ := pow_le_pow_left₀ (Nat.cast_nonneg _) hprod _ _ = _ := by rw [← Real.exp_nat_mul] congr 1 ring
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
theorem residuePrimeCoordinateDensity_section_norm {ι σ : Type*} [Fintype ι] [DecidableEq ι] [Fintype σ] [DecidableEq σ] (lo : σ → ℤ) (N : σ → ℕ) (M : ℕ) (a : σ → ℤ) (hne : Nonempty (IntegerResidueBox lo (fun k => lo k + N k) (fun _ => (M : ℤ)) a)) (q : ι → ℕ) [∀ i, NeZero (q i)] (hpair : Pairwise (fun i k => (q i).Coprime (q k))) (K : Finset ι) (base : ∀ i, σ → ZMod (q i)) (u : ResiduePrimeCoordinateCell lo N M a q K base) (f : (σ → ℤ) → ℝ) (B : ℕ) : Real.sqrt (productANOVAEnergy (primeCoordinateReference (σ := σ) q) (lowDegreeCoordinateSets ι B) (productSectionAverage (primeCoordinateReference (σ := σ) q) K K base (residuePrimeCoordinateDensity lo N M a hne q f))) = residuePrimeCoordinateMassRatio lo N M a q K base * Real.sqrt (productANOVAEnergy (primeCoordinateReference (σ := σ) (fun i : {i // i ∉ K} => q i.val)) (lowDegreeCoordinateSets {i // i ∉ K} B) (residueCellOutsideDensity lo N M a q K base u f)) := by have hs := funext (residuePrimeCoordinateDensity_section lo N M a hne q hpair K base u f) rw [hs, sqrt_productANOVAEnergy_smul, productANOVAEnergy_outside (primeCoordinateReference (σ := σ) q) K base B, abs_of_nonneg (residuePrimeCoordinateMassRatio_pos lo N M a q K base u).le] rfl
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
theorem residueSectionPairing_core {ι σ τ : Type*} [Fintype ι] [DecidableEq ι] [Fintype σ] [DecidableEq σ] [Fintype τ] [DecidableEq τ] (loX : σ → ℤ) (NX : σ → ℕ) (MX : ℕ) (aX : σ → ℤ) (hneX : Nonempty (IntegerResidueBox loX (fun k => loX k + NX k) (fun _ => (MX : ℤ)) aX)) (loY : τ → ℤ) (NY : τ → ℕ) (MY : ℕ) (aY : τ → ℤ) (hneY : Nonempty (IntegerResidueBox loY (fun k => loY k + NY k) (fun _ => (MY : ℤ)) aY)) (q : ι → ℕ) [∀ i, NeZero (q i)] (hpair : Pairwise (fun i k => (q i).Coprime (q k))) (K : Finset ι) (baseX : ∀ i, σ → ZMod (q i)) (baseY : ∀ i, τ → ZMod (q i)) (uX : ResiduePrimeCoordinateCell loX NX MX aX q K baseX) (uY : ResiduePrimeCoordinateCell loY NY MY aY q K baseY) (c : ∀ i, FiniteProbabilityCoupling (primeCoordinateReference (σ := σ) q i) (primeCoordinateReference (σ := τ) q i)) (w : (σ → ℤ) → ℝ) (f : (τ → ℤ) → ℝ) (B : ℕ) : productTruncatedPairing c (conditioningCoreSupports K B) (productSectionAverage (primeCoordinateReference (σ := σ) q) K K baseX (residuePrimeCoordinateDensity loX NX MX aX hneX q w)) (productSectionAverage (primeCoordinateReference (σ := τ) q) K K baseY (residuePrimeCoordinateDensity loY NY MY aY hneY q f)) = residuePrimeCoordinateMassRatio loX NX MX aX q K baseX * residuePrimeCoordinateMassRatio loY NY MY aY q K baseY * productTruncatedPairing (fun i : {i // i ∉ K} => c i.val) (lowDegreeCoordinateSets {i // i ∉ K} (B - K.card)) (residueCellOutsideDensity loX NX MX aX q K baseX uX w) (residueCellOutsideDensity loY NY MY aY q K baseY uY f) := by have hx := funext (residuePrimeCoordinateDensity_section loX NX MX aX hneX q hpair K baseX uX w) have hy := funext (residuePrimeCoordinateDensity_section loY NY MY aY hneY q hpair K baseY uY f) rw [hx, hy, productTruncatedPairing_smul, productTruncatedPairing_outside_core c K baseX baseY B]
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
theorem residue_initial_conditioning_shell {ι σ τ : Type*} [Fintype ι] [DecidableEq ι] [Fintype σ] [DecidableEq σ] [Fintype τ] [DecidableEq τ] (loX : σ → ℤ) (NX : σ → ℕ) (MX : ℕ) (aX : σ → ℤ) (hneX : Nonempty (IntegerResidueBox loX (fun k => loX k + NX k) (fun _ => (MX : ℤ)) aX)) (loY : τ → ℤ) (NY : τ → ℕ) (MY : ℕ) (aY : τ → ℤ) (hneY : Nonempty (IntegerResidueBox loY (fun k => loY k + NY k) (fun _ => (MY : ℤ)) aY)) (q : ι → ℕ) [∀ i, NeZero (q i)] (hpair : Pairwise (fun i k => (q i).Coprime (q k))) (K : Finset ι) (baseX : ∀ i, σ → ZMod (q i)) (baseY : ∀ i, τ → ZMod (q i)) (uX : ResiduePrimeCoordinateCell loX NX MX aX q K baseX) (uY : ResiduePrimeCoordinateCell loY NY MY aY q K baseY) (kernel : ∀ i, (σ → ZMod (q i)) → FiniteProbabilityWeights (τ → ZMod (q i))) (C : ι → ℝ) (hC : ∀ i, 0 ≤ C i) (hbound : ∀ i (f : (τ → ZMod (q i)) → ℝ), (primeCoordinateReference (σ := τ) q i).mean f = 0 → (primeCoordinateReference (σ := σ) q i).mean (fun x => (kernel i x).mean f ^ 2) ≤ C i * (primeCoordinateReference (σ := τ) q i).mean (fun y => f y ^ 2)) (hmean : ∀ i (f : (τ → ZMod (q i)) → ℝ), (primeCoordinateReference (σ := σ) q i).mean (fun x => (kernel i x).mean f) = (primeCoordinateReference (σ := τ) q i).mean f) (w : (σ → ℤ) → ℝ) (f : (τ → ℤ) → ℝ) (B : ℕ) (hKB : K.card ≤ B) {κ sourceNorm siteNorm : ℝ} (hκ0 : 0 ≤ κ) (hκ1 : κ ≤ 1) (hcap : ∀ i ∉ K, C i ≤ κ ^ 2) (hsourceNorm : Real.sqrt (productANOVAEnergy (primeCoordinateReference (σ := σ) (fun i : {i // i ∉ K} => q i.val)) (lowDegreeCoordinateSets {i // i ∉ K} B) (residueCellOutsideDensity loX NX MX aX q K baseX uX w)) ≤ sourceNorm) (hsiteNorm : Real.sqrt (productANOVAEnergy (primeCoordinateReference (σ := τ) (fun i : {i // i ∉ K} => q i.val)) (lowDegreeCoordinateSets {i // i ∉ K} B) (residueCellOutsideDensity loY NY MY aY q K baseY uY f)) ≤ siteNorm) : let c := fun i => FiniteProbabilityCoupling.ofKernel (primeCoordinateReference (σ := σ) q i) (primeCoordinateReference (σ := τ) q i) (kernel i) (hmean i) |productAtomTruncatedPairing c (lowDegreeCoordinateSets ι B) K baseX baseY (residuePrimeCoordinateDensity loX NX MX aX hneX q w) (residuePrimeCoordinateDensity loY NY MY aY hneY q f) - productCouplingAtomMass c K baseX baseY * (residuePrimeCoordinateMassRatio loX NX MX aX q K baseX * residuePrimeCoordinateMassRatio loY NY MY aY q K baseY * productTruncatedPairing (fun i : {i // i ∉ K} => c i.val) (lowDegreeCoordinateSets {i // i ∉ K} (B - K.card)) (residueCellOutsideDensity loX NX MX aX q K baseX uX w) (residueCellOutsideDensity loY NY MY aY q K baseY uY f))| ≤ (2 : ℝ) ^ K.card * (κ ^ (B - K.card) * (residuePrimeCoordinateMassRatio loX NX MX aX q K baseX * sourceNorm) * (residuePrimeCoordinateMassRatio loY NY MY aY q K baseY * siteNorm)) := by let μ := primeCoordinateReference (σ := σ) q let ν := primeCoordinateReference (σ := τ) q let c := fun i => FiniteProbabilityCoupling.ofKernel (μ i) (ν i) (kernel i) (hmean i) have hx : Real.sqrt (productANOVAEnergy μ (lowDegreeCoordinateSets ι B) (productSectionAverage μ K K baseX (residuePrimeCoordinateDensity loX NX MX aX hneX q w))) ≤ residuePrimeCoordinateMassRatio loX NX MX aX q K baseX * sourceNorm := by rw [residuePrimeCoordinateDensity_section_norm loX NX MX aX hneX q hpair K baseX uX w B] exact mul_le_mul_of_nonneg_left hsourceNorm (residuePrimeCoordinateMassRatio_pos loX NX MX aX q K baseX uX).le have hy : Real.sqrt (productANOVAEnergy ν (lowDegreeCoordinateSets ι B) (productSectionAverage ν K K baseY (residuePrimeCoordinateDensity loY NY MY aY hneY q f))) ≤ residuePrimeCoordinateMassRatio loY NY MY aY q K baseY * siteNorm := by rw [residuePrimeCoordinateDensity_section_norm loY NY MY aY hneY q hpair K baseY uY f B] exact mul_le_mul_of_nonneg_left hsiteNorm (residuePrimeCoordinateMassRatio_pos loY NY MY aY q K baseY uY).le have hshell := productKernel_conditioning_shell_of_truncated μ ν kernel C hC hbound hmean K B hKB hκ0 hκ1 hcap baseX baseY (residuePrimeCoordinateDensity loX NX MX aX hneX q w) (residuePrimeCoordinateDensity loY NY MY aY hneY q f) hx hy change |productAtomTruncatedPairing c (lowDegreeCoordinateSets ι B) K baseX baseY (residuePrimeCoordinateDensity loX NX MX aX hneX q w) (residuePrimeCoordinateDensity loY NY MY aY hneY q f) - productCouplingAtomMass c K baseX baseY * productTruncatedPairing c (conditioningCoreSupports K B) (productSectionAverage μ K K baseX (residuePrimeCoordinateDensity loX NX MX aX hneX q w)) (productSectionAverage ν K K baseY (residuePrimeCoordinateDensity loY NY MY aY hneY q f))| ≤ _ at hshell rw [residueSectionPairing_core loX NX MX aX hneX loY NY MY aY hneY q hpair K baseX baseY uX uY c w f B] at hshell exact hshell
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
theorem residue_initial_conditioning_shell_of_lengths {ι σ τ : Type*} [Fintype ι] [DecidableEq ι] [Fintype σ] [DecidableEq σ] [Fintype τ] [DecidableEq τ] (loX : σ → ℤ) (NX : σ → ℕ) (MX : ℕ) (aX : σ → ℤ) (hneX : Nonempty (IntegerResidueBox loX (fun k => loX k + NX k) (fun _ => (MX : ℤ)) aX)) (loY : τ → ℤ) (NY : τ → ℕ) (MY : ℕ) (aY : τ → ℤ) (hneY : Nonempty (IntegerResidueBox loY (fun k => loY k + NY k) (fun _ => (MY : ℤ)) aY)) (q : ι → ℕ) [∀ i, NeZero (q i)] (hpair : Pairwise (fun i k => (q i).Coprime (q k))) (K : Finset ι) (baseX : ∀ i, σ → ZMod (q i)) (baseY : ∀ i, τ → ZMod (q i)) (uX : ResiduePrimeCoordinateCell loX NX MX aX q K baseX) (uY : ResiduePrimeCoordinateCell loY NY MY aY q K baseY) (kernel : ∀ i, (σ → ZMod (q i)) → FiniteProbabilityWeights (τ → ZMod (q i))) (C : ι → ℝ) (hC : ∀ i, 0 ≤ C i) (hbound : ∀ i (f : (τ → ZMod (q i)) → ℝ), (primeCoordinateReference (σ := τ) q i).mean f = 0 → (primeCoordinateReference (σ := σ) q i).mean (fun x => (kernel i x).mean f ^ 2) ≤ C i * (primeCoordinateReference (σ := τ) q i).mean (fun y => f y ^ 2)) (hmean : ∀ i (f : (τ → ZMod (q i)) → ℝ), (primeCoordinateReference (σ := σ) q i).mean (fun x => (kernel i x).mean f) = (primeCoordinateReference (σ := τ) q i).mean f) (w : (σ → ℤ) → ℝ) (f : (τ → ℤ) → ℝ) (B : ℕ) (hKB : K.card ≤ B) {κ : ℝ} (hκ0 : 0 ≤ κ) (hκ1 : κ ≤ 1) (hcap : ∀ i ∉ K, C i ≤ κ ^ 2) (hMX : 0 < MX) (hMY : 0 < MY) (hcopX : ∀ i ∉ K, MX.Coprime (q i)) (hcopY : ∀ i ∉ K, MY.Coprime (q i)) (hw : ∀ z : ResiduePrimeCoordinateCell loX NX MX aX q K baseX, 0 ≤ w (fun k => (z.val k).val) ∧ w (fun k => (z.val k).val) ≤ 1) (hf : ∀ z : ResiduePrimeCoordinateCell loY NY MY aY q K baseY, 0 ≤ f (fun k => (z.val k).val) ∧ f (fun k => (z.val k).val) ≤ 1) (P modLog dimX dimY : ℝ) (hP : 0 ≤ P) (hmodLog : 0 ≤ modLog) (hcount : (Fintype.card ι : ℝ) ≤ Real.exp P) (hmoduli : ∀ i ∉ K, (q i : ℝ) ≤ Real.exp modLog) (hdimX : (Fintype.card σ : ℝ) ≤ Real.exp dimX) (hdimY : (Fintype.card τ : ℝ) ≤ Real.exp dimY) (hlengthX : ∀ k, Real.exp (modLog * (2 * B : ℕ) + affineComparisonAccuracyLog B P 0 0 + dimX + 1) ≤ (residueIndexLength (loX k) (loX k + NX k) (MX.lcm (∏ i ∈ K, q i)) ((uX.val k).val) : ℝ)) (hlengthY : ∀ k, Real.exp (modLog * (2 * B : ℕ) + affineComparisonAccuracyLog B P 0 0 + dimY + 1) ≤ (residueIndexLength (loY k) (loY k + NY k) (MY.lcm (∏ i ∈ K, q i)) ((uY.val k).val) : ℝ)) : let c := fun i => FiniteProbabilityCoupling.ofKernel (primeCoordinateReference (σ := σ) q i) (primeCoordinateReference (σ := τ) q i) (kernel i) (hmean i) |productAtomTruncatedPairing c (lowDegreeCoordinateSets ι B) K baseX baseY (residuePrimeCoordinateDensity loX NX MX aX hneX q w) (residuePrimeCoordinateDensity loY NY MY aY hneY q f) - productCouplingAtomMass c K baseX baseY * (residuePrimeCoordinateMassRatio loX NX MX aX q K baseX * residuePrimeCoordinateMassRatio loY NY MY aY q K baseY * productTruncatedPairing (fun i : {i // i ∉ K} => c i.val) (lowDegreeCoordinateSets {i // i ∉ K} (B - K.card)) (residueCellOutsideDensity loX NX MX aX q K baseX uX w) (residueCellOutsideDensity loY NY MY aY q K baseY uY f))| ≤ (2 : ℝ) ^ K.card * (κ ^ (B - K.card) * (residuePrimeCoordinateMassRatio loX NX MX aX q K baseX * 3) * (residuePrimeCoordinateMassRatio loY NY MY aY q K baseY * 3)) := by have hx := residueCellOutsideDensity_norm_of_lengths (ι := ι) (σ := σ) loX NX MX aX q hMX hpair K baseX hcopX uX w hw B P modLog dimX hP hmodLog hcount hmoduli hdimX hlengthX have hy := residueCellOutsideDensity_norm_of_lengths (ι := ι) (σ := τ) loY NY MY aY q hMY hpair K baseY hcopY uY f hf B P modLog dimY hP hmodLog hcount hmoduli hdimY hlengthY exact residue_initial_conditioning_shell loX NX MX aX hneX loY NY MY aY hneY q hpair K baseX baseY uX uY kernel C hC hbound hmean w f B hKB hκ0 hκ1 hcap hx hy
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
theorem residue_initial_conditioning_shell_small {ι σ τ : Type*} [Fintype ι] [DecidableEq ι] [Fintype σ] [DecidableEq σ] [Fintype τ] [DecidableEq τ] (loX : σ → ℤ) (NX : σ → ℕ) (MX : ℕ) (aX : σ → ℤ) (hneX : Nonempty (IntegerResidueBox loX (fun k => loX k + NX k) (fun _ => (MX : ℤ)) aX)) (loY : τ → ℤ) (NY : τ → ℕ) (MY : ℕ) (aY : τ → ℤ) (hneY : Nonempty (IntegerResidueBox loY (fun k => loY k + NY k) (fun _ => (MY : ℤ)) aY)) (q : ι → ℕ) [∀ i, NeZero (q i)] (hpair : Pairwise (fun i k => (q i).Coprime (q k))) (K : Finset ι) (baseX : ∀ i, σ → ZMod (q i)) (baseY : ∀ i, τ → ZMod (q i)) (uX : ResiduePrimeCoordinateCell loX NX MX aX q K baseX) (uY : ResiduePrimeCoordinateCell loY NY MY aY q K baseY) (kernel : ∀ i, (σ → ZMod (q i)) → FiniteProbabilityWeights (τ ��� ZMod (q i))) (C : ι → ℝ) (hC : ∀ i, 0 ≤ C i) (hbound : ∀ i (f : (τ → ZMod (q i)) → ℝ), (primeCoordinateReference (σ := τ) q i).mean f = 0 → (primeCoordinateReference (σ := σ) q i).mean (fun x => (kernel i x).mean f ^ 2) ≤ C i * (primeCoordinateReference (σ := τ) q i).mean (fun y => f y ^ 2)) (hmean : ∀ i (f : (τ → ZMod (q i)) → ℝ), (primeCoordinateReference (σ := σ) q i).mean (fun x => (kernel i x).mean f) = (primeCoordinateReference (σ := τ) q i).mean f) (w : (σ → ℤ) → ℝ) (f : (τ → ℤ) → ℝ) (B : ℕ) {κ : ℝ} (hκ0 : 0 ≤ κ) (hκhalf : κ ≤ 1 / 2) (hcap : ∀ i ∉ K, C i ≤ κ ^ 2) (hMX : 0 < MX) (hMY : 0 < MY) (hcopX : ∀ i ∉ K, MX.Coprime (q i)) (hcopY : ∀ i ∉ K, MY.Coprime (q i)) (hw : ∀ z : ResiduePrimeCoordinateCell loX NX MX aX q K baseX, 0 ≤ w (fun k => (z.val k).val) ∧ w (fun k => (z.val k).val) ≤ 1) (hf : ∀ z : ResiduePrimeCoordinateCell loY NY MY aY q K baseY, 0 ≤ f (fun k => (z.val k).val) ∧ f (fun k => (z.val k).val) ≤ 1) (P modLog dimX dimY : ℝ) (hP : 0 ≤ P) (hmodLog : 0 ≤ modLog) (hcount : (Fintype.card ι : ℝ) ≤ Real.exp P) (hmoduli : ∀ i, (q i : ℝ) ≤ Real.exp modLog) (hdimX : (Fintype.card σ : ℝ) ≤ Real.exp dimX) (hdimY : (Fintype.card τ : ℝ) ≤ Real.exp dimY) (hlengthX : ∀ k, Real.exp (modLog * (2 * B : ℕ) + affineComparisonAccuracyLog B P 0 0 + dimX + 1) ≤ (residueIndexLength (loX k) (loX k + NX k) (MX.lcm (∏ i ∈ K, q i)) ((uX.val k).val) : ℝ)) (hlengthY : ∀ k, Real.exp (modLog * (2 * B : ℕ) + affineComparisonAccuracyLog B P 0 0 + dimY + 1) ≤ (residueIndexLength (loY k) (loY k + NY k) (MY.lcm (∏ i ∈ K, q i)) ((uY.val k).val) : ℝ)) (shell : ℝ) (hshell : 0 < shell) (hB : K.card + CyclicCrootSisask.spectralIterations shell ((K.card : ℝ) * ((Fintype.card σ : ℝ) * modLog + (Fintype.card τ : ℝ) * modLog + 1) + 4) ≤ B) : let c := fun i => FiniteProbabilityCoupling.ofKernel (primeCoordinateReference (σ := σ) q i) (primeCoordinateReference (σ := τ) q i) (kernel i) (hmean i) |productAtomTruncatedPairing c (lowDegreeCoordinateSets ι B) K baseX baseY (residuePrimeCoordinateDensity loX NX MX aX hneX q w) (residuePrimeCoordinateDensity loY NY MY aY hneY q f) - productCouplingAtomMass c K baseX baseY * (residuePrimeCoordinateMassRatio loX NX MX aX q K baseX * residuePrimeCoordinateMassRatio loY NY MY aY q K baseY * productTruncatedPairing (fun i : {i // i ∉ K} => c i.val) (lowDegreeCoordinateSets {i // i ∉ K} (B - K.card)) (residueCellOutsideDensity loX NX MX aX q K baseX uX w) (residueCellOutsideDensity loY NY MY aY q K baseY uY f))| ≤ shell / 16 := by have hsmallX : residuePrimeCoordinateMassRatio loX NX MX aX q K baseX ≤ Real.exp ((K.card : ℝ) * ((Fintype.card σ : ℝ) * modLog)) := by simpa only [mul_assoc] using residuePrimeCoordinateMassRatio_le_exp loX NX MX aX q K baseX uX modLog hmoduli have hsmallY : residuePrimeCoordinateMassRatio loY NY MY aY q K baseY ≤ Real.exp ((K.card : ℝ) * ((Fintype.card τ : ℝ) * modLog)) := by simpa only [mul_assoc] using residuePrimeCoordinateMassRatio_le_exp loY NY MY aY q K baseY uY modLog hmoduli have hbudget := initial_conditioning_error_small K.card B (residuePrimeCoordinateMassRatio_pos loX NX MX aX q K baseX uX).le (residuePrimeCoordinateMassRatio_pos loY NY MY aY q K baseY uY).le hsmallX hsmallY hκ0 hκhalf hshell hB have hresult := residue_initial_conditioning_shell_of_lengths loX NX MX aX hneX loY NY MY aY hneY q hpair K baseX baseY uX uY kernel C hC hbound hmean w f B (by omega) hκ0 (by linarith) hcap hMX hMY hcopX hcopY hw hf P modLog dimX dimY hP hmodLog hcount (fun i _ => hmoduli i) hdimX hdimY hlengthX hlengthY exact hresult.trans hbudget
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
theorem affine_period_initial_conditioning_shell_small {ι J σ : Type*} [Fintype ι] [DecidableEq ι] [Fintype J] [Fintype σ] (loX : (Option J × σ) → ℤ) (NX : (Option J × σ) → ℕ) (MX : ℕ) (aX : (Option J × σ) → ℤ) (hneX : Nonempty (IntegerResidueBox loX (fun k => loX k + NX k) (fun _ => (MX : ℤ)) aX)) (loY : σ → ℤ) (NY : σ → ℕ) (MY : ℕ) (aY : σ → ℤ) (hneY : Nonempty (IntegerResidueBox loY (fun k => loY k + NY k) (fun _ => (MY : ℤ)) aY)) (q : ι → ℕ) [∀ i, NeZero (q i)] (hpair : Pairwise (fun i k => (q i).Coprime (q k))) (K : Finset ι) (baseX : ∀ i, (Option J × σ) → ZMod (q i)) (baseY : ∀ i, σ → ZMod (q i)) (uX : ResiduePrimeCoordinateCell loX NX MX aX q K baseX) (uY : ResiduePrimeCoordinateCell loY NY MY aY q K baseY) (D : ℕ) (a : J → ℤ) (hDcop : ∀ i ∉ K, D.Coprime (q i)) (prime power : ι → ℕ) (hprime : ∀ i, (prime i).Prime) (hpower : ∀ i, q i = prime i ^ power i) (hJ : 2 ≤ Fintype.card J) (w : ((Option J × σ) → ℤ) → ℝ) (f : (σ → ℤ) → ℝ) (B : ℕ) {κ : ℝ} (hκ0 : 0 ≤ κ) (hκhalf : κ ≤ 1 / 2) (hlarge : ∀ i ∉ K, (prime i : ℝ)⁻¹ ≤ κ) (hMX : 0 < MX) (hMY : 0 < MY) (hcopX : ∀ i ∉ K, MX.Coprime (q i)) (hcopY : ∀ i ∉ K, MY.Coprime (q i)) (hw : ∀ z : ResiduePrimeCoordinateCell loX NX MX aX q K baseX, 0 ≤ w (fun k => (z.val k).val) ∧ w (fun k => (z.val k).val) ≤ 1) (hf : ∀ z : ResiduePrimeCoordinateCell loY NY MY aY q K baseY, 0 ≤ f (fun k => (z.val k).val) ∧ f (fun k => (z.val k).val) ≤ 1) (P modLog dimX dimY : ℝ) (hP : 0 ≤ P) (hmodLog : 0 ≤ modLog) (hcount : (Fintype.card ι : ℝ) ≤ Real.exp P) (hmoduli : ∀ i, (q i : ℝ) ≤ Real.exp modLog) (hdimX : (Fintype.card (Option J × σ) : ℝ) ≤ Real.exp dimX) (hdimY : (Fintype.card σ : ℝ) ≤ Real.exp dimY) (hlengthX : ∀ k, Real.exp (modLog * (2 * B : ℕ) + affineComparisonAccuracyLog B P 0 0 + dimX + 1) ≤ (residueIndexLength (loX k) (loX k + NX k) (MX.lcm (∏ i ∈ K, q i)) ((uX.val k).val) : ℝ)) (hlengthY : ∀ k, Real.exp (modLog * (2 * B : ℕ) + affineComparisonAccuracyLog B P 0 0 + dimY + 1) ≤ (residueIndexLength (loY k) (loY k + NY k) (MY.lcm (∏ i ∈ K, q i)) ((uY.val k).val) : ℝ)) (shell : ℝ) (hshell : 0 < shell) (hB : K.card + CyclicCrootSisask.spectralIterations shell ((K.card : ℝ) * ((Fintype.card (Option J × σ) : ℝ) * modLog + (Fintype.card σ : ℝ) * modLog + 1) + 4) ≤ B) : let c := affinePeriodProductCoupling (σ := σ) q D a |productAtomTruncatedPairing c (lowDegreeCoordinateSets ι B) K baseX baseY (residuePrimeCoordinateDensity loX NX MX aX hneX q w) (residuePrimeCoordinateDensity loY NY MY aY hneY q f) - productCouplingAtomMass c K baseX baseY * (residuePrimeCoordinateMassRatio loX NX MX aX q K baseX * residuePrimeCoordinateMassRatio loY NY MY aY q K baseY * affineResidueTruncatedPairing (J := J) (σ := σ) (fun i : {i // i ∉ K} => q i.val) (lowDegreeCoordinateSets {i // i ∉ K} (B - K.card)) (residueCellOutsideDensity loX NX MX aX q K baseX uX w) (residueCellOutsideDensity loY NY MY aY q K baseY uY f))| ≤ shell / 16 := by let kernel := fun i => affineSampleParameterKernel (I := σ) (affinePeriodParameterLaw (q := q i) D a) let C := fun i => if i ∈ K then (1 : ℝ) else κ ^ 2 have hC (i : ι) : 0 ≤ C i := by dsimp only [C] split_ifs <;> positivity have hbound := affinePeriodParameterKernel_centered_sq (σ := σ) q D a K prime power hprime hpower hDcop hκ0 hJ hlarge have hmean := fun i => affineSampleParameterKernel_preserves_mean (I := σ) (affinePeriodParameterLaw (q := q i) D a) have hcap (i : ι) (hi : i ∉ K) : C i ≤ κ ^ 2 := by simp only [C, ite_eq_right hi, le_refl] have hresult := residue_initial_conditioning_shell_small loX NX MX aX hneX loY NY MY aY hneY q hpair K baseX baseY uX uY kernel C hC hbound hmean w f B hκ0 hκhalf hcap hMX hMY hcopX hcopY hw hf P modLog dimX dimY hP hmodLog hcount hmoduli hdimX hdimY hlengthX hlengthY shell hshell hB change |productAtomTruncatedPairing (affinePeriodProductCoupling (σ := σ) q D a) (lowDegreeCoordinateSets ι B) K baseX baseY (residuePrimeCoordinateDensity loX NX MX aX hneX q w) (residuePrimeCoordinateDensity loY NY MY aY hneY q f) - productCouplingAtomMass (affinePeriodProductCoupling (σ := σ) q D a) K baseX baseY * (residuePrimeCoordinateMassRatio loX NX MX aX q K baseX * residuePrimeCoordinateMassRatio loY NY MY aY q K baseY * productTruncatedPairing (fun i : {i // i ∉ K} => affinePeriodProductCoupling (σ := σ) q D a i.val) (lowDegreeCoordinateSets {i // i ∉ K} (B - K.card)) (residueCellOutsideDensity loX NX MX aX q K baseX uX w) (residueCellOutsideDensity loY NY MY aY q K baseY uY f))| ≤ shell / 16 at hresult rw [affinePeriodProductCoupling_outside q D a K hDcop] at hresult exact hresult
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
theorem affine_masked_initial_conditioning_shell_small {ι J σ : Type*} [Fintype ι] [DecidableEq ι] [Fintype J] [Fintype σ] (loX : (Option J × σ) → ℤ) (NX : (Option J × σ) → ℕ) (MX : ℕ) (aX : (Option J × σ) → ℤ) (hneX : Nonempty (IntegerResidueBox loX (fun k => loX k + NX k) (fun _ => (MX : ℤ)) aX)) (loY : σ → ℤ) (NY : σ → ℕ) (MY : ℕ) (aY : σ → ℤ) (hneY : Nonempty (IntegerResidueBox loY (fun k => loY k + NY k) (fun _ => (MY : ℤ)) aY)) (q : ι → ℕ) [∀ i, NeZero (q i)] (K : Finset ι) (baseX : ∀ i, (Option J × σ) → ZMod (q i)) (baseY : ∀ i, σ → ZMod (q i)) (uX : ResiduePrimeCoordinateCell loX NX MX aX q K baseX) (uY : ResiduePrimeCoordinateCell loY NY MY aY q K baseY) (D : ℕ) (a : J → ���) (prime power : ι → ℕ) (hprime : ∀ i, (prime i).Prime) (hpower : ∀ i, q i = prime i ^ power i) (hinj : Function.Injective prime) (hJ : 2 ≤ Fintype.card J) (w : ((Option J × σ) → ℤ) → ℝ) (f : (σ → ℤ) → ℝ) (B : ℕ) (hMX : 0 < MX) (hMY : 0 < MY) (hw : ∀ z : ResiduePrimeCoordinateCell loX NX MX aX q K baseX, 0 ≤ w (fun k => (z.val k).val) ∧ w (fun k => (z.val k).val) ≤ 1) (hf : ∀ z : ResiduePrimeCoordinateCell loY NY MY aY q K baseY, 0 ≤ f (fun k => (z.val k).val) ∧ f (fun k => (z.val k).val) ≤ 1) (P modLog dimX dimY : ℝ) (hP : 0 ≤ P) (hmodLog : 0 ≤ modLog) (ξ : ℝ) (hξ : 0 < ξ) (hmask : affineSamplerPrimeMask prime ξ P MX MY D ⊆ K) (hcount : (Fintype.card ι : ℝ) ≤ Real.exp P) (hmoduli : ∀ i, (q i : ℝ) ≤ Real.exp modLog) (hdimX : (Fintype.card (Option J × σ) : ℝ) ≤ Real.exp dimX) (hdimY : (Fintype.card σ : ℝ) ≤ Real.exp dimY) (hlengthX : ∀ k, Real.exp (modLog * (2 * B : ℕ) + affineComparisonAccuracyLog B P 0 0 + dimX + 1) ≤ (residueIndexLength (loX k) (loX k + NX k) (MX.lcm (∏ i ∈ K, q i)) ((uX.val k).val) : ℝ)) (hlengthY : ∀ k, Real.exp (modLog * (2 * B : ℕ) + affineComparisonAccuracyLog B P 0 0 + dimY + 1) ≤ (residueIndexLength (loY k) (loY k + NY k) (MY.lcm (∏ i ∈ K, q i)) ((uY.val k).val) : ℝ)) (shell : ℝ) (hshell : 0 < shell) (hB : K.card + CyclicCrootSisask.spectralIterations shell ((K.card : ℝ) * ((Fintype.card (Option J × σ) : ℝ) * modLog + (Fintype.card σ : ℝ) * modLog + 1) + 4) ≤ B) : let c := affinePeriodProductCoupling (σ := σ) q D a |productAtomTruncatedPairing c (lowDegreeCoordinateSets ι B) K baseX baseY (residuePrimeCoordinateDensity loX NX MX aX hneX q w) (residuePrimeCoordinateDensity loY NY MY aY hneY q f) - productCouplingAtomMass c K baseX baseY * (residuePrimeCoordinateMassRatio loX NX MX aX q K baseX * residuePrimeCoordinateMassRatio loY NY MY aY q K baseY * affineResidueTruncatedPairing (J := J) (σ := σ) (fun i : {i // i ∉ K} => q i.val) (lowDegreeCoordinateSets {i // i ∉ K} (B - K.card)) (residueCellOutsideDensity loX NX MX aX q K baseX uX w) (residueCellOutsideDensity loY NY MY aY q K baseY uY f))| ≤ shell / 16 := by have hpair : Pairwise (fun i k => (q i).Coprime (q k)) := by intro i k hik rw [hpower i, hpower k] exact selectedPrimePowers_pairwise_coprime prime power hprime hinj hik have houtside := affineSamplerPrimeMask_outside prime power hprime hP K hmask have hcopX (i : ι) (hi : i ∉ K) : MX.Coprime (q i) := by rw [hpower i] exact (houtside i hi).1 have hcopY (i : ι) (hi : i ∉ K) : MY.Coprime (q i) := by rw [hpower i] exact (houtside i hi).2.1 have hDcop (i : ι) (hi : i ∉ K) : D.Coprime (q i) := by rw [hpower i] exact (houtside i hi).2.2.1 have hlarge (i : ι) (hi : i ∉ K) : (prime i : ℝ)⁻¹ ≤ affineComparisonContraction ξ P := (houtside i hi).2.2.2 have hκ := affineComparisonContraction_bounds hξ hP exact affine_period_initial_conditioning_shell_small loX NX MX aX hneX loY NY MY aY hneY q hpair K baseX baseY uX uY D a hDcop prime power hprime hpower hJ w f B hκ.1.le hκ.2.1 hlarge hMX hMY hcopX hcopY hw hf P modLog dimX dimY hP hmodLog hcount hmoduli hdimX hdimY hlengthX hlengthY shell hshell hB
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646import OAI.Combinatorics.Progressions.Estimates.PhysicalBoundaryLabelsimport OAI.Combinatorics.Progressions.Estimates.RealFiniteZeroExtensionimport OAI.Combinatorics.Progressions.Estimates.WeightedSmoothSampledErrorimport OAI.Combinatorics.Progressions.Probability.LargeDivisorPairProbabilityimport OAI.Combinatorics.Progressions.Probability.RelativeFullSliceLaw
namespace OAI
section
namespace Erdos3
open scoped BigOperators Classical
theorem interval_event_probability (a b : ℤ) (hab : a < b) (E : ℤ → Prop) [DecidablePred E] : (intervalUniformWeights a b hab).eventProbability (fun x => E (x : ℤ)) = ((Finset.filter E (Finset.Ico a b)).card : ℝ) / ((b - a : ℤ) : ℝ) := by unfold FiniteProbabilityWeights.eventProbability rw [intervalUniformWeights_mean] convert integerInterval_indicator_expect a b hab.le E using 1 congr 1 funext x split_ifs <;> rfl
theorem interval_near_probability (a b v : ℤ) (hab : a < b) (r : ℕ) : (intervalUniformWeights a b hab).eventProbability (fun x => |(x : ℤ) - v| ≤ (r : ℤ)) ≤ (2 * (r : ℝ) + 1) / ((b - a : ℤ) : ℝ) := by rw [interval_event_probability a b hab (fun x => |x - v| ≤ (r : ℤ))] have hsub : (Finset.filter (fun x => |x - v| ≤ (r : ℤ)) (Finset.Ico a b)) ⊆ Finset.Icc (v - (r : ℤ)) (v + (r : ℤ)) := by intro x hx have h := abs_le.mp (Finset.mem_filter.mp hx).2 exact Finset.mem_Icc.mpr ⟨by omega, by omega⟩ have he : (Finset.Icc (v - (r : ℤ)) (v + (r : ℤ))).card = 2 * r + 1 := by rw [Int.card_Icc] omega have hc : ((Finset.filter (fun x => |x - v| ≤ (r : ℤ)) (Finset.Ico a b)).card : ℝ) ≤ 2 * (r : ℝ) + 1 := by have h := Finset.card_le_card hsub rw [he] at h exact_mod_cast h exact div_le_div_of_nonneg_right hc (by exact_mod_cast (sub_pos.mpr hab).le)
theorem integer_box_near_probability {J : Type*} [Fintype J] [DecidableEq J] (lo hi : J → ℤ) (hlen : ∀ j, lo j < hi j) (v : J → ℤ) (r : ℕ) : (integerBoxUniformWeights lo hi hlen).eventProbability (fun y => ∀ j, |(y j : ℤ) - v j| ≤ (r : ℤ)) ≤ ∏ j, (2 * (r : ℝ) + 1) / ((hi j - lo j : ℤ) : ℝ) := by rw [integerBoxUniformWeights, FiniteProbabilityWeights.eventProbability_pi (fun j => intervalUniformWeights (lo j) (hi j) (hlen j)) (fun j (y : Finset.Ico (lo j) (hi j)) => |(y : ℤ) - v j| ≤ (r : ℤ))] apply Finset.prod_le_prod₀ · intro j _ exact FiniteProbabilityWeights.eventProbability_nonneg _ _ · intro j _ exact interval_near_probability (lo j) (hi j) (v j) (hlen j) r
theorem integer_box_pair_near_probability {J : Type*} [Fintype J] [DecidableEq J] (lo hi : J → ℤ) (hlen : ∀ j, lo j < hi j) (r : ℕ) : ((integerBoxUniformWeights lo hi hlen).prod (integerBoxUniformWeights lo hi hlen)).eventProbability (fun xy => ∀ j, |(xy.2 j : ℤ) - (xy.1 j : ℤ)| ≤ (r : ℤ)) ≤ ∏ j, (2 * (r : ℝ) + 1) / ((hi j - lo j : ℤ) : ℝ) := by unfold FiniteProbabilityWeights.eventProbability rw [FiniteProbabilityWeights.mean_prod] apply (FiniteProbabilityWeights.mean_mono _ ?_).trans_eq (FiniteProbabilityWeights.mean_const _ _) intro x exact integer_box_near_probability lo hi hlen (fun j => (x j : ℤ)) r
theorem integer_box_pair_near_probability_of_lengths {J : Type*} [Fintype J] [DecidableEq J] (lo hi : J → ℤ) (hlen : ∀ j, lo j < hi j) (r : ℕ) {L : ℝ} (hL : 0 < L) (hside : ∀ j, L ≤ ((hi j - lo j : ℤ) : ℝ)) : ((integerBoxUniformWeights lo hi hlen).prod (integerBoxUniformWeights lo hi hlen)).eventProbability (fun xy => ∀ j, |(xy.2 j : ℤ) - (xy.1 j : ℤ)| ≤ (r : ℤ)) ≤ ((2 * (r : ℝ) + 1) / L) ^ Fintype.card J := by apply (integer_box_pair_near_probability lo hi hlen r).trans calc _ ≤ ∏ _j : J, (2 * (r : ℝ) + 1) / L := by apply Finset.prod_le_prod₀ · intro j _ have hj : (0 : ℝ) < ((hi j - lo j : ℤ) : ℝ) := hL.trans_le (hside j) positivity · intro j _ exact div_le_div_of_nonneg_left (by positivity) hL (hside j) _ = _ := by simp [div_pow]
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
theorem integer_vector_content_natAbs_scale {J : Type*} [Fintype J] (D : ℕ) (z : J → ℤ) : (BohrLattice.Primitive.content (fun j => (D : ℤ) * z j)).natAbs = D * (BohrLattice.Primitive.content z).natAbs := by simp only [BohrLattice.Primitive.content, Finset.gcd_mul_left, Int.normalize_coe_nat, Int.natAbs_mul, Int.natAbs_natCast]
theorem affine_parameter_difference_gcd {J : Type*} [Fintype J] (D : ℕ) (a x y : J → ℤ) : (BohrLattice.Primitive.content (fun j => (a j + (D : ℤ) * y j) - (a j + (D : ℤ) * x j))).natAbs = D * (BohrLattice.Primitive.content (fun j => y j - x j)).natAbs := by have he : (fun j => (a j + (D : ℤ) * y j) - (a j + (D : ℤ) * x j)) = (fun j => (D : ��) * (y j - x j)) := by funext j; ring rw [he, integer_vector_content_natAbs_scale]
theorem integer_box_pair_gcd_probability {J : Type*} [Fintype J] [DecidableEq J] (lo hi : J → ℤ) (hlen : ∀ j, lo j < hi j) (B R : ℕ) (hB : 0 < B) (hdim : 2 ≤ Fintype.card J) {L : ℝ} (hL : 0 < L) (hside : ∀ j, L ≤ ((hi j - lo j : ℤ) : ℝ)) (hwidth : ∀ j, hi j - lo j ≤ (R : ℤ)) : ((integerBoxUniformWeights lo hi hlen).prod (integerBoxUniformWeights lo hi hlen)).eventProbability (fun xy => B < (BohrLattice.Primitive.content (fun j => (xy.2 j : ℤ) - (xy.1 j : ℤ))).natAbs) ≤ 2 ^ (Fintype.card J - 1) * (1 / (B : ℝ) ^ (Fintype.card J - 1) + (R : ℝ) / L ^ Fintype.card J) := by apply (FiniteProbabilityWeights.eventProbability_mono _ _ _ ?_).trans (integer_box_pair_nonzero_large_divisor_probability lo hi hlen B R hB hdim hL hside hwidth) intro xy h refine ⟨?_, (BohrLattice.Primitive.content (fun j => (xy.2 j : ℤ) - (xy.1 j : ℤ))).natAbs, h, ?_⟩ · intro he have hz : Finset.univ.gcd (fun _ : J => (0 : ℤ)) = 0 := Finset.gcd_eq_zero_iff.mpr (fun _ _ => rfl) simp [he, BohrLattice.Primitive.content, hz] at h · intro j exact Int.natAbs_dvd.mpr (BohrLattice.Primitive.content_dvd _ j)
theorem affine_parameter_pair_gcd_probability {J : Type*} [Fintype J] [DecidableEq J] (lo hi : J → ℤ) (hlen : ∀ j, lo j < hi j) (D Q B R : ℕ) (a : J → ℤ) (hBQ : D * B ≤ Q) (hB : 0 < B) (hdim : 2 ≤ Fintype.card J) {L : ℝ} (hL : 0 < L) (hside : ∀ j, L ≤ ((hi j - lo j : ℤ) : ℝ)) (hwidth : ∀ j, hi j - lo j ≤ (R : ℤ)) : ((integerBoxUniformWeights lo hi hlen).prod (integerBoxUniformWeights lo hi hlen)).eventProbability (fun xy => Q < (BohrLattice.Primitive.content (fun j => (a j + (D : ℤ) * (xy.2 j : ℤ)) - (a j + (D : ℤ) * (xy.1 j : ℤ)))).natAbs) ≤ 2 ^ (Fintype.card J - 1) * (1 / (B : ℝ) ^ (Fintype.card J - 1) + (R : ℝ) / L ^ Fintype.card J) := by apply (FiniteProbabilityWeights.eventProbability_mono _ _ _ ?_).trans (integer_box_pair_gcd_probability lo hi hlen B R hB hdim hL hside hwidth) intro xy h rw [affine_parameter_difference_gcd] at h exact Nat.lt_of_mul_lt_mul_left (hBQ.trans_lt h)
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
theorem integerBoxUniformWeights_mean {J : Type*} [Fintype J] [DecidableEq J] (lo hi : J → ℤ) (hlen : ∀ j, lo j < hi j) (f : (∀ j, Finset.Ico (lo j) (hi j)) → ℝ) : (integerBoxUniformWeights lo hi hlen).mean f = 𝔼 x, f x := by let : ∀ j, Nonempty (Finset.Ico (lo j) (hi j)) := fun j => ⟨⟨lo j, Finset.mem_Ico.mpr ⟨le_rfl, hlen j⟩⟩⟩ have he : integerBoxUniformWeights lo hi hlen = FiniteProbabilityWeights.uniform (∀ j, Finset.Ico (lo j) (hi j)) := by apply FiniteProbabilityWeights.eq_of_weight_eq intro x change (∏ j, (Fintype.card (Finset.Ico (lo j) (hi j)) : ℝ)⁻¹) = (Fintype.card (∀ j, Finset.Ico (lo j) (hi j)) : ℝ)⁻¹ rw [Fintype.card_pi, Nat.cast_prod, Finset.prod_inv_distrib] rw [he, FiniteProbabilityWeights.uniform_mean]
theorem finite_event_probability_or_le {X : Type*} [Fintype X] (p : FiniteProbabilityWeights X) (A B : X → Prop) : p.eventProbability (fun x => A x ∨ B x) ≤ p.eventProbability A + p.eventProbability B := by have hpoint (x : X) : (@ite ℝ (A x ∨ B x) (Classical.propDecidable _) 1 0) ≤ (@ite ℝ (A x) (Classical.propDecidable _) 1 0) + (@ite ℝ (B x) (Classical.propDecidable _) 1 0) := by by_cases ha : A x <;> by_cases hb : B x <;> simp [ha, hb] exact (p.mean_mono hpoint).trans_eq (p.mean_add _ _)
def affineParameterBadPair {J : Type*} [Fintype J] (D Q r : ℕ) (a x y : J → ℤ) : Prop := Q < (BohrLattice.Primitive.content (fun j => (a j + (D : ℤ) * y j) - (a j + (D : ℤ) * x j))).natAbs ∨ ∀ j, |y j - x j| ≤ (r : ℤ)
noncomputable def integerBoxBadPairBudget (d B R r : ℕ) (L : ℝ) : ℝ := 2 ^ (d - 1) * (1 / (B : ℝ) ^ (d - 1) + (R : ℝ) / L ^ d) + ((2 * (r : ℝ) + 1) / L) ^ d
theorem affine_parameter_bad_pair_probability {J : Type*} [Fintype J] [DecidableEq J] (lo hi : J → ℤ) (hlen : ∀ j, lo j < hi j) (D Q B R r : ℕ) (a : J → ℤ) (hBQ : D * B ≤ Q) (hB : 0 < B) (hdim : 2 ≤ Fintype.card J) {L : ℝ} (hL : 0 < L) (hside : ∀ j, L ≤ ((hi j - lo j : ℤ) : ℝ)) (hwidth : ∀ j, hi j - lo j ≤ (R : ℤ)) : ((integerBoxUniformWeights lo hi hlen).prod (integerBoxUniformWeights lo hi hlen)).eventProbability (fun xy => affineParameterBadPair D Q r a (fun j => (xy.1 j : ℤ)) (fun j => (xy.2 j : ℤ))) ≤ integerBoxBadPairBudget (Fintype.card J) B R r L := by unfold affineParameterBadPair integerBoxBadPairBudget apply (finite_event_probability_or_le _ _ _).trans exact add_le_add (affine_parameter_pair_gcd_probability lo hi hlen D Q B R a hBQ hB hdim hL hside hwidth) (integer_box_pair_near_probability_of_lengths lo hi hlen r hL hside)
theorem sampled_affine_integer_box_error {Ω J : Type*} [Fintype Ω] [Fintype J] [DecidableEq J] (p : FiniteProbabilityWeights Ω) (lo hi : J → ℤ) (hlen : ∀ j, lo j < hi j) (D Q B R r : ℕ) (a : J → ℤ) (hBQ : D * B ≤ Q) (hB : 0 < B) (hdim : 2 ≤ Fintype.card J) {L : ℝ} (hL : 0 < L) (hside : ∀ j, L ≤ ((hi j - lo j : ℤ) : ℝ)) (hwidth : ∀ j, hi j - lo j ≤ (R : ℤ)) (e : Ω → (∀ j, Finset.Ico (lo j) (hi j)) → ℝ) {C epsilon : ℝ} (hC : 0 ≤ C) (hepsilon : 0 ≤ epsilon) (henergy : ∀ t, p.mean (fun x => e x t ^ 2) ≤ C) (hgood : ∀ (t u : ∀ j, Finset.Ico (lo j) (hi j)), ¬ affineParameterBadPair D Q r a (fun j => (t j : ℤ)) (fun j => (u j : ℤ)) → |p.mean (fun x => e x t * e x u)| ≤ epsilon) (w : Ω → ℝ) (hw : ∀ x, 0 ≤ w x ∧ w x ≤ 1) : |p.mean (fun x => w x * (𝔼 t, e x t))| ≤ Real.sqrt (C * integerBoxBadPairBudget (Fintype.card J) B R r L + epsilon) := by have h := sampled_weighted_error_of_energy p (integerBoxUniformWeights lo hi hlen) e (fun tu => affineParameterBadPair D Q r a (fun j => (tu.1 j : ℤ)) (fun j => (tu.2 j : ℤ))) hC hepsilon henergy (affine_parameter_bad_pair_probability lo hi hlen D Q B R r a hBQ hB hdim hL hside hwidth) (fun tu htu => hgood tu.1 tu.2 htu) w hw simpa only [integerBoxUniformWeights_mean] using h
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
theorem expect_le_of_dependent_coordinate_slices {I : Type*} [Fintype I] [DecidableEq I] {X : I → Type*} [∀ i, Fintype (X i)] [∀ i, Nonempty (X i)] (i : I) (f : (∀ j, X j) → ℝ) (C : ℝ) (hslice : ∀ x : ∀ j, X j, (𝔼 a : X i, f (Function.update x i a)) ≤ C) : (𝔼 x : ∀ j, X j, f x) ≤ C := by let e := Equiv.piSplitAt i X have he := Fintype.expect_equiv e f (fun p => f (e.symm p)) (fun x => by simp) rw [he, ← Finset.univ_product_univ, Finset.expect_product, Finset.expect_comm] apply Finset.expect_le Finset.univ_nonempty intro r _ let x : ∀ j, X j := e.symm (Classical.choice inferInstance, r) have hupdate (a : X i) : e.symm (a, r) = Function.update x i a := by funext j by_cases hj : j = i · subst j simp [e, Equiv.piSplitAt] · simp [e, x, Equiv.piSplitAt, hj] simpa only [hupdate] using hslice x
theorem integer_box_affine_near_probability {J I : Type*} [Fintype J] [DecidableEq J] [Fintype I] [DecidableEq I] (lo hi : Option J × I → ℤ) (hlen : ∀ j, lo j < hi j) (t : J → ℤ) (i : I) (b : ℤ) (r : ℕ) : (integerBoxUniformWeights lo hi hlen).eventProbability (fun z => |smoothAffineSample t (fun j => (z j : ℤ)) i - b| ≤ (r : ℤ)) ≤ (2 * (r : ℝ) + 1) / ((hi (none, i) - lo (none, i) : ℤ) : ℝ) := by let : ∀ j, Nonempty (Finset.Ico (lo j) (hi j)) := fun j => ⟨⟨lo j, Finset.mem_Ico.mpr ⟨le_rfl, hlen j⟩⟩⟩ unfold FiniteProbabilityWeights.eventProbability rw [integerBoxUniformWeights_mean] apply expect_le_of_dependent_coordinate_slices (none, i) intro z have h := interval_near_probability (lo (none, i)) (hi (none, i)) (b - ∑ j, t j * (z (some j, i) : ℤ)) (hlen (none, i)) r unfold FiniteProbabilityWeights.eventProbability at h rw [intervalUniformWeights_mean] at h convert h using 1 apply Finset.expect_congr rfl intro a _ have he : smoothAffineSample t (fun j => ((Function.update z (none, i) a) j : ℤ)) i - b = (a : ℤ) - (b - ∑ j, t j * (z (some j, i) : ℤ)) := by simp [smoothAffineSample, Function.update] ring dsimp only simp only [he] split_ifs <;> rfl
end Erdos3
end
section
namespace Erdos3.ResidueBoxSlice
open scoped BigOperators Classical
variable {X : Type*} [Fintype X] [DecidableEq X] {N : X → ℕ} {q : ℕ}
theorem fullSliceLaw_mean_eq_rectangle (S : ResidueBoxSlice N q) (hlen : ∀ i, 0 < S.length i) (f : (X → ℤ) → ℝ) : (S.fullSliceLaw hlen).mean (fun x => f x.val) = (integerBoxUniformWeights (fun _ : X => 0) (fun i => (S.length i : ℤ)) (fun i => by exact_mod_cast hlen i)).mean (fun t => f (fun i => (S.start i : ℤ) + (q : ℤ) * (t i).val)) := by rw [fullSliceLaw_mean, integerBoxUniformWeights_mean] let forward (u : ∀ i, Fin (S.length i)) : ∀ i, Finset.Ico (0 : ℤ) (S.length i : ℤ) := fun i => ⟨((u i).val : ℤ), Finset.mem_Ico.mpr ⟨Int.natCast_nonneg _, by exact_mod_cast (u i).isLt⟩⟩ apply Finset.expect_bij (fun u _ => forward u) · intro u _ exact Finset.mem_univ _ · intro u _ simp only [forward, fullSlicePointInIntegerBox, point, Nat.cast_add, Nat.cast_mul] · intro u _ v _ he funext i apply Fin.ext have hi := congrArg (fun t => (t i).val) he dsimp only [forward] at hi exact_mod_cast hi · intro t _ let u : ∀ i, Fin (S.length i) := fun i => ⟨(t i).val.toNat, by have := Finset.mem_Ico.mp (t i).property; omega⟩ refine ⟨u, Finset.mem_univ _, ?_⟩ funext i apply Subtype.ext change (((t i).val.toNat : ℕ) : ℤ) = (t i).val exact Int.toNat_of_nonneg (Finset.mem_Ico.mp (t i).property).1
omit [Fintype X] [DecidableEq X] intheorem fullSliceRectangle_endpoint_bounds (S : ResidueBoxSlice N q) (hlen : ∀ i, 0 < S.length i) {L C : ℝ} (hL : 0 < L) (hN : ∀ i, (N i : ℝ) ≤ C * L) (i : X) : |(S.start i : ℝ) / L| ≤ C ∧ |((S.start i : ℝ) + (q : ℝ) * S.length i) / L| ≤ C + q / L := by have hstart : S.start i < N i := by simpa using S.inside i 0 (hlen i) have hlast := S.inside i (S.length i - 1) (by have := hlen i; omega) have hend : S.start i + q * S.length i < N i + q := by have he : S.start i + q * S.length i = (S.start i + q * (S.length i - 1)) + q := by have hl : S.length i = (S.length i - 1) + 1 := by have := hlen i; omega conv_lhs => rw [hl] ring rw [he] omega have hstartR : (S.start i : ℝ) < N i := by exact_mod_cast hstart have hendR : (S.start i : ℝ) + (q : ℝ) * S.length i < (N i : ℝ) + q := by exact_mod_cast hend constructor · rw [abs_of_nonneg (div_nonneg (Nat.cast_nonneg _) hL.le)] exact (div_le_iff₀ hL).mpr (hstartR.le.trans (hN i)) · rw [abs_of_nonneg (by positivity)] apply (div_le_iff₀ hL).mpr rw [add_mul, div_mul_cancel₀ _ hL.ne'] linarith [hN i]
omit [Fintype X] [DecidableEq X] intheorem fullSliceRectangle_endpoint_bounds_two (S : ResidueBoxSlice N q) (hlen : ∀ i, 2 ≤ S.length i) {L C : ℝ} (hL : 0 < L) (hN : ∀ i, (N i : ℝ) ≤ C * L) (i : X) : |(S.start i : ℝ) / L| ≤ C ∧ |((S.start i : ℝ) + (q : ℝ) * S.length i) / L| ≤ 2 * C := by have hbase := fullSliceRectangle_endpoint_bounds S (fun i => by have := hlen i; omega) hL hN i have hqN : q < N i := by have h := S.inside i 1 (by have := hlen i; omega) omega have hqR : (q : ℝ) ≤ C * L := (show (q : ℝ) ≤ (N i : ℝ) by exact_mod_cast hqN.le).trans (hN i) have hqL : (q : ℝ) / L ≤ C := (div_le_iff₀ hL).mpr hqR exact ⟨hbase.1, hbase.2.trans (by linarith)⟩
end Erdos3.ResidueBoxSlice
end
section
namespace Erdos3
theorem integerBoxBadPairBudget_nonneg (d B R r : ℕ) {M : ℝ} (hM : 0 ≤ M) : 0 ≤ integerBoxBadPairBudget d B R r M := by unfold integerBoxBadPairBudget positivity
theorem integerBoxBadPairBudget_le_separated (d B R r : ℕ) {M C nu : ℝ} (hd : 2 ≤ d) (hB : 0 < B) (hBM : (B : ℝ) ≤ M) (hC : 0 ≤ C) (hR : (R : ℝ) ≤ C * M) (hr : (r : ℝ) ≤ nu * M) (hinv : 1 / M ≤ nu) : integerBoxBadPairBudget d B R r M ≤ 2 ^ (d - 1) * (1 + C) / (B : ℝ) ^ (d - 1) + (3 * nu) ^ d := by have hBp : (0 : ℝ) < B := by exact_mod_cast hB have hM : 0 < M := hBp.trans_le hBM have hpow : (B : ℝ) ^ (d - 1) ≤ M ^ (d - 1) := pow_le_pow_left₀ hBp.le hBM _ have hR' : (R : ℝ) / M ^ d ≤ C / (B : ℝ) ^ (d - 1) := by calc _ ≤ (C * M) / M ^ d := div_le_div_of_nonneg_right hR (by positivity) _ = C / M ^ (d - 1) := by conv_lhs => rw [show d = (d - 1) + 1 by omega, pow_succ] field_simp _ ≤ C / (B : ℝ) ^ (d - 1) := div_le_div_of_nonneg_left hC (by positivity) hpow have hnear : (2 * (r : ℝ) + 1) / M ≤ 3 * nu := by have hrr : (r : ℝ) / M ≤ nu := (div_le_iff₀ hM).mpr hr calc _ = 2 * ((r : ℝ) / M) + 1 / M := by ring _ ≤ 3 * nu := by linarith unfold integerBoxBadPairBudget calc _ ≤ 2 ^ (d - 1) * (1 / (B : ℝ) ^ (d - 1) + C / (B : ℝ) ^ (d - 1)) + (3 * nu) ^ d := add_le_add (mul_le_mul_of_nonneg_left (add_le_add le_rfl hR') (by positivity)) (pow_le_pow_left₀ (by positivity) hnear d) _ = _ := by ring
theorem integerBoxBadPairBudget_le_linear (d B R r : ℕ) {M C nu : ℝ} (hd : 2 ≤ d) (hB : 0 < B) (hBM : (B : ℝ) ≤ M) (hC : 0 ≤ C) (hR : (R : ℝ) ≤ C * M) (hr : (r : ℝ) ≤ nu * M) (hinv : 1 / M ≤ nu) (hnu : nu ≤ 1) : integerBoxBadPairBudget d B R r M ≤ 2 ^ (d - 1) * (1 + C) / (B : ℝ) + 3 ^ d * nu := by have hB1 : (1 : ℝ) ≤ B := by exact_mod_cast hB have hBp : (0 : ℝ) < B := by exact_mod_cast hB have hM : 0 < M := hBp.trans_le hBM have hnu0 : 0 ≤ nu := (by positivity : 0 ≤ 1 / M).trans hinv have hpow : (B : ℝ) ≤ (B : ℝ) ^ (d - 1) := by simpa only [pow_one] using pow_le_pow_right₀ hB1 (show 1 ≤ d - 1 by omega) have hnpow : nu ^ d ≤ nu := by obtain ⟨m, rfl⟩ := Nat.exists_eq_succ_of_ne_zero (show d ≠ 0 by omega) rw [pow_succ] exact (mul_le_mul_of_nonneg_right (pow_le_one₀ hnu0 hnu) hnu0).trans_eq (one_mul nu) apply (integerBoxBadPairBudget_le_separated d B R r hd hB hBM hC hR hr hinv).trans apply add_le_add · exact div_le_div_of_nonneg_left (by positivity) hBp hpow · rw [mul_pow] exact mul_le_mul_of_nonneg_left hnpow (by positivity)
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
theorem integerBox_weighted_joint_mean {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] (lo hi : I → ℤ) (hsource : ∀ i, lo i < hi i) (parLo parHi : J → ℤ) (hparam : ∀ j, parLo j < parHi j) (w : (I → ℤ) → ℝ) (f : (I → ℤ) → (∀ j, Finset.Ico (parLo j) (parHi j)) → ℝ) : ((integerBoxUniformWeights parLo parHi hparam).prod (integerBoxUniformWeights lo hi hsource)).mean (fun tx => w (fun i => (tx.2 i).val) * f (fun i => (tx.2 i).val) tx.1) = 𝔼 z ∈ Fintype.piFinset (fun i => Finset.Ico (lo i) (hi i)), w z * (𝔼 t, f z t) := by rw [FiniteProbabilityWeights.mean_prod, FiniteProbabilityWeights.mean_comm] simp only [FiniteProbabilityWeights.mean_const_mul, integerBoxUniformWeights_mean] rw [← finiteBoxPoints_expect (fun i => Finset.Ico (lo i) (hi i)) (fun z => w z * (𝔼 t, f z t))] simp only [Finset.expect_eq_sum_div_card, Finset.card_univ, Fintype.card_coe] congr 1 simpa only [Finset.expect_eq_sum_div_card, Finset.card_univ] using Finset.sum_coe_sort (Fintype.piFinset (fun i => Finset.Ico (lo i) (hi i))) (fun z => w z * (𝔼 t, f z t))
theorem integerBox_joint_error_of_window_tests {I J : Type*} [Fintype I] [DecidableEq I] [Fintype J] [DecidableEq J] (lo hi : I → ℤ) (hsource : ∀ i, lo i < hi i) (parLo parHi : J → ℤ) (hparam : ∀ j, parLo j < parHi j) (f : (I → ℤ) → (∀ j, Finset.Ico (parLo j) (parHi j)) → ℝ) (accuracy : ℝ) (htest : ∀ v : (I → ℤ) → ℝ, (∀ z, 0 ≤ v z ∧ v z ≤ 1) → |𝔼 z ∈ Fintype.piFinset (fun i => Finset.Ico (lo i) (hi i)), v z * (𝔼 t, f z t)| ≤ accuracy) (w : (I → ℤ) → ℝ) (hw : ∀ z : (∀ i, Finset.Ico (lo i) (hi i)), 0 ≤ w (fun i => (z i).val) ∧ w (fun i => (z i).val) ≤ 1) : |((integerBoxUniformWeights parLo parHi hparam).prod (integerBoxUniformWeights lo hi hsource)).mean (fun tx => w (fun i => (tx.2 i).val) * f (fun i => (tx.2 i).val) tx.1)| ≤ accuracy := by let W := Fintype.piFinset (fun i => Finset.Ico (lo i) (hi i)) have hwW (z) (hz : z ∈ W) : 0 ≤ w z ∧ w z ≤ 1 := by exact hw (fun i => ⟨z i, Fintype.mem_piFinset.mp hz i⟩) have h := htest (realZeroExtendFinset W w) (realZeroExtendFinset_unit W w hwW) rw [integerBox_weighted_joint_mean lo hi hsource parLo parHi hparam w f] convert h using 2 apply Finset.expect_congr rfl intro z hz rw [realZeroExtendFinset_on W w hz]
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
noncomputable def physicalBoundaryBudget {I : Type*} [Fintype I] (N : I → ℕ) (P : ∀ i, FiniteProgressionPartition (N i)) (r : I → ℕ) (width : I → ℝ) : ℝ := ∑ i, 2 * (Fintype.card (P i).Label : ℝ) * (2 * (r i : ℝ) + 1) / width i
theorem integer_box_physical_boundary_probability {J I : Type*} [Fintype J] [DecidableEq J] [Fintype I] [DecidableEq I] (sourceLo sourceHi : Option J × I → ℤ) (hsource : ∀ j, sourceLo j < sourceHi j) (t : J → ℤ) (lo : I → ℤ) (N : I → ℕ) (P : ∀ i, FiniteProgressionPartition (N i)) (r : I → ℕ) : (integerBoxUniformWeights sourceLo sourceHi hsource).eventProbability (fun z => physicalBoundaryNear lo N P r (smoothAffineSample t (fun j => (z j : ℤ)))) ≤ physicalBoundaryBudget N P r (fun i => ((sourceHi (none, i) - sourceLo (none, i) : ℤ) : ℝ)) := by let p := integerBoxUniformWeights sourceLo sourceHi hsource let E := fun (e : Σ i, (P i).Label) (z : ∀ j, Finset.Ico (sourceLo j) (sourceHi j)) => |smoothAffineSample t (fun j => (z j : ℤ)) e.1 - intervalCellLower (lo e.1) (P e.1) e.2| ≤ (r e.1 : ℤ) ∨ |smoothAffineSample t (fun j => (z j : ℤ)) e.1 - intervalCellUpper (lo e.1) (P e.1) e.2| ≤ (r e.1 : ℤ) have hE (e : Σ i, (P i).Label) : p.eventProbability (E e) ≤ 2 * ((2 * (r e.1 : ℝ) + 1) / ((sourceHi (none, e.1) - sourceLo (none, e.1) : ℤ) : ℝ)) := by apply (p.eventProbability_or_le _ _).trans have hleft := integer_box_affine_near_probability sourceLo sourceHi hsource t e.1 (intervalCellLower (lo e.1) (P e.1) e.2) (r e.1) have hright := integer_box_affine_near_probability sourceLo sourceHi hsource t e.1 (intervalCellUpper (lo e.1) (P e.1) e.2) (r e.1) linarith have hcover (z : ∀ j, Finset.Ico (sourceLo j) (sourceHi j)) (h : physicalBoundaryNear lo N P r (smoothAffineSample t (fun j => (z j : ℤ)))) : ∃ e, E e z := by obtain ⟨i, c, hc⟩ := h exact ⟨⟨i, c⟩, hc⟩ apply (p.eventProbability_union_bound _ E hcover).trans calc _ ≤ ∑ e : Σ i, (P i).Label, 2 * ((2 * (r e.1 : ℝ) + 1) / ((sourceHi (none, e.1) - sourceLo (none, e.1) : ℤ) : ℝ)) := Finset.sum_le_sum (fun e _ => hE e) _ = _ := by rw [Fintype.sum_sigma] unfold physicalBoundaryBudget apply Finset.sum_congr rfl intro i _ dsimp only rw [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] ring
theorem sampled_physical_boundary_probability {J I T : Type*} [Fintype J] [DecidableEq J] [Fintype I] [DecidableEq I] [Fintype T] (parameterLaw : FiniteProbabilityWeights T) (parameter : T → J → ℤ) (sourceLo sourceHi : Option J × I → ℤ) (hsource : ∀ j, sourceLo j < sourceHi j) (lo : I → ℤ) (N : I → ℕ) (P : ∀ i, FiniteProgressionPartition (N i)) (r : I → ℕ) : (parameterLaw.prod (integerBoxUniformWeights sourceLo sourceHi hsource)).eventProbability (fun tz => physicalBoundaryNear lo N P r (smoothAffineSample (parameter tz.1) (fun j => (tz.2 j : ℤ)))) ≤ physicalBoundaryBudget N P r (fun i => ((sourceHi (none, i) - sourceLo (none, i) : ℤ) : ℝ)) := by unfold FiniteProbabilityWeights.eventProbability rw [FiniteProbabilityWeights.mean_prod] apply (parameterLaw.mean_mono (fun t => integer_box_physical_boundary_probability sourceLo sourceHi hsource (parameter t) lo N P r)).trans_eq exact parameterLaw.mean_const _
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
noncomputable def physicalMeshCrossing {I X M : Type*} [Fintype I] [DecidableEq I] (lo : I → ℤ) (N : I → ℕ) (P : ∀ i, FiniteProgressionPartition (N i)) (mesh : X → M) (location : X → I → ℤ) (x : X) : Prop := ∃ y, mesh y = mesh x ∧ physicalBoxClassify lo N P (location x) ≠ physicalBoxClassify lo N P (location y)
theorem retained_mesh_cell_constant {I X M : Type*} [Fintype I] [DecidableEq I] (lo : I → ℤ) (N : I → ℕ) (P : ∀ i, FiniteProgressionPartition (N i)) (mesh : X → M) (location : X → I → ℤ) (x : X) (hx : ¬ physicalMeshCrossing lo N P mesh location x) : ∀ y, mesh y = mesh x → physicalBoxClassify lo N P (location y) = physicalBoxClassify lo N P (location x) := by intro y hy by_contra h exact hx ⟨y, hy, Ne.symm h⟩
theorem physicalMeshCrossing_congr {I X M : Type*} [Fintype I] [DecidableEq I] (lo : I → ℤ) (N : I → ℕ) (P : ∀ i, FiniteProgressionPartition (N i)) (mesh : X → M) (location : X → I → ℤ) {x y : X} (hxy : mesh x = mesh y) : physicalMeshCrossing lo N P mesh location x ↔ physicalMeshCrossing lo N P mesh location y := by have transfer (u v : X) (huv : mesh u = mesh v) (hu : physicalMeshCrossing lo N P mesh location u) : physicalMeshCrossing lo N P mesh location v := by obtain ⟨z, hz, huz⟩ := hu by_cases hvz : physicalBoxClassify lo N P (location v) = physicalBoxClassify lo N P (location z) · exact ⟨u, huv, fun hvu => huz (hvu.symm.trans hvz)⟩ · exact ⟨z, hz.trans huv, hvz⟩ exact ⟨transfer x y hxy, transfer y x hxy.symm⟩
theorem physicalMeshCrossing_subset_boundary {I X M : Type*} [Fintype I] [DecidableEq I] (lo : I → ℤ) (N : I → ℕ) (P : ∀ i, FiniteProgressionPartition (N i)) (hstep : ∀ i c, (P i).step c = 1) (hpos : ∀ i c, 0 < (P i).length c) (mesh : X → M) (location : X → I → ℤ) (r : I → ℕ) (hmove : ∀ x y, mesh y = mesh x → ∀ i, |location x i - location y i| ≤ (r i : ℤ)) (x : X) (hx : physicalMeshCrossing lo N P mesh location x) : physicalBoundaryNear lo N P r (location x) := by by_contra hn obtain ⟨y, hy, hxy⟩ := hx exact hxy (physicalBoxClassify_stable lo N P hstep hpos r (location x) (location y) (hmove x y hy) hn)
theorem affine_mesh_crossing_probability {J I T SCell TCell : Type*} [Fintype J] [DecidableEq J] [Fintype I] [DecidableEq I] [Fintype T] (parameterLaw : FiniteProbabilityWeights T) (parameter : T → J → ℤ) (sourceLo sourceHi : Option J × I → ℤ) (hsource : ∀ j, sourceLo j < sourceHi j) (sourceCell : (∀ j, Finset.Ico (sourceLo j) (sourceHi j)) → SCell) (parameterCell : T → TCell) (lo : I → ℤ) (N : I → ℕ) (P : ∀ i, FiniteProgressionPartition (N i)) (hstep : ∀ i c, (P i).step c = 1) (hpos : ∀ i c, 0 < (P i).length c) (r : I → ℕ) (r0 rV V : I → ℝ) (Tcap rt : ℝ) (hT : 0 ≤ Tcap) (hV : ∀ i, 0 ≤ V i) (ht : ∀ t j, |(parameter t j : ℝ)| ≤ Tcap) (hv : ∀ (z : ∀ j, Finset.Ico (sourceLo j) (sourceHi j)) j i, |((z (some j, i) : ℤ) : ℝ)| ≤ V i) (hbase : ∀ z w, sourceCell w = sourceCell z → ∀ i, |((z (none, i) : ℤ) : ℝ) - ((w (none, i) : ℤ) : ℝ)| ≤ r0 i) (hdir : ∀ z w, sourceCell w = sourceCell z → ∀ j i, |((z (some j, i) : ℤ) : ℝ) - ((w (some j, i) : ℤ) : ℝ)| ≤ rV i) (hparam : ∀ t u, parameterCell u = parameterCell t → ∀ j, |(parameter t j : ℝ) - parameter u j| ≤ rt) (hbudget : ∀ i, r0 i + (Fintype.card J : ℝ) * (Tcap * rV i + V i * rt) ≤ (r i : ℝ)) : (parameterLaw.prod (integerBoxUniformWeights sourceLo sourceHi hsource)).eventProbability (physicalMeshCrossing lo N P (fun tz => (sourceCell tz.2, parameterCell tz.1)) (fun tz => smoothAffineSample (parameter tz.1) (fun j => (tz.2 j : ℤ)))) ≤ physicalBoundaryBudget N P r (fun i => ((sourceHi (none, i) - sourceLo (none, i) : ℤ) : ℝ)) := by let mesh := fun tz : T × (∀ j, Finset.Ico (sourceLo j) (sourceHi j)) => (sourceCell tz.2, parameterCell tz.1) let location := fun tz : T × (∀ j, Finset.Ico (sourceLo j) (sourceHi j)) => smoothAffineSample (parameter tz.1) (fun j => (tz.2 j : ℤ)) have hmove (x y : T × (∀ j, Finset.Ico (sourceLo j) (sourceHi j))) (he : mesh y = mesh x) (i : I) : |location x i - location y i| ≤ (r i : ℤ) := by have hs : sourceCell y.2 = sourceCell x.2 := congrArg Prod.fst he have hp : parameterCell y.1 = parameterCell x.1 := congrArg Prod.snd he have h := (smoothAffineSample_variation (parameter x.1) (parameter y.1) (fun j => (x.2 j : ℤ)) (fun j => (y.2 j : ℤ)) i hT (hV i) (ht x.1) (fun j => hv y.2 j i) (hbase x.2 y.2 hs i) (fun j => hdir x.2 y.2 hs j i) (hparam x.1 y.1 hp)).trans (hbudget i) exact_mod_cast h apply (FiniteProbabilityWeights.eventProbability_mono _ _ _ (physicalMeshCrossing_subset_boundary lo N P hstep hpos mesh location r hmove)).trans exact sampled_physical_boundary_probability parameterLaw parameter sourceLo sourceHi hsource lo N P r
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336import OAI.Combinatorics.Progressions.Estimates.FiniteRetainedCellMeanimport OAI.Combinatorics.Progressions.Estimates.PhysicalZeroExtensionimport OAI.Combinatorics.Progressions.Estimates.RetainedPhysicalDifferenceimport OAI.Combinatorics.Progressions.Lattices.ConcreteAffineMeshBoundary
namespace OAI
section
namespace Erdos3
open scoped BigOperators Classical
theorem affine_mesh_truncation_bound {ι I J : Type*} [Fintype ι] [DecidableEq ι] [Fintype I] [Fintype J] (lo : I → ℤ) (N : I → ℕ) (P : ∀ i, FiniteProgressionPartition (N i)) (hPstep : ∀ i c, (P i).step c = 1) (hPpos : ∀ i c, 0 < (P i).length c) (sourceLo sourceHi : Option J × I → ℤ) (hsource : ∀ i, sourceLo i < sourceHi i) (S : ∀ i, FiniteProgressionPartition (sourceHi i - sourceLo i).toNat) (hSstep : ∀ i c, (S i).step c = 1) (hSpos : ∀ i c, 0 < (S i).length c) (paramLo paramHi : J → ℤ) (hparam : ∀ j, paramLo j < paramHi j) (T : ∀ j, FiniteProgressionPartition (paramHi j - paramLo j).toNat) (hTstep : ∀ j c, (T j).step c = 1) (hTpos : ∀ j c, 0 < (T j).length c) (D : ℕ) (a : J → ℤ) (q : ι → ℕ) [∀ i, NeZero (q i)] (b : ℕ) (w : (Option J × I → ℤ) → ℝ) (h g : (I → ℤ) → ℝ) (hw : ∀ z : (∀ i, Finset.Ico (sourceLo i) (sourceHi i)), 0 ≤ w (fun i => (z i).val) ∧ w (fun i => (z i).val) ≤ 1) (hh : ∀ x ∈ translatedIntegerBox lo N, 0 ≤ h x ∧ h x ≤ 1) (hg : ∀ x ∈ translatedIntegerBox lo N, 0 ≤ g x ∧ g x ≤ 1) {etaParam etaSite r R beta : ℝ} (hetaParam : 0 ≤ etaParam) (hetaSite : 0 ≤ etaSite) (hr : 0 ≤ r) (hR : 0 ≤ R) (hcloseParam : ∀ ct : (∀ j, (T j).Label), ProductMarginalsClose (primeCoordinateReference (σ := J) q) (residuePrimeCoordinateDensity (fun j => intervalCellLower (paramLo j) (T j) (ct j)) (fun j => (T j).length (ct j)) 1 (fun _ => 0) (physicalBoxCell_nonempty paramLo (fun j => (paramHi j - paramLo j).toNat) T hTpos ct) q (fun _ => 1)) etaParam b) (hcloseSite : ∀ c : (∀ i, (P i).Label), ProductMarginalsClose (primeCoordinateReference (σ := I) q) (residuePrimeCoordinateDensity (fun i => intervalCellLower (lo i) (P i) (c i)) (fun i => (P i).length (c i)) 1 (fun _ => 0) (physicalBoxCell_nonempty lo N P hPpos c) q (fun _ => 1)) etaSite b) (hreference : ∀ cs : (∀ i, (S i).Label), ∀ c : (∀ i, (P i).Label), productTruncatedPairing (affinePeriodProductCoupling (σ := I) q D a) (lowDegreeCoordinateSets ι b) (residuePrimeCoordinateDensity (fun i => intervalCellLower (sourceLo i) (S i) (cs i)) (fun i => (S i).length (cs i)) 1 (fun _ => 0) (physicalBoxCell_nonempty sourceLo (fun i => (sourceHi i - sourceLo i).toNat) S hSpos cs) q w) (fun x => residuePrimeCoordinateDensity (fun i => intervalCellLower (lo i) (P i) (c i)) (fun i => (P i).length (c i)) 1 (fun _ => 0) (physicalBoxCell_nonempty lo N P hPpos c) q h x - r * residuePrimeCoordinateDensity (fun i => intervalCellLower (lo i) (P i) (c i)) (fun i => (P i).length (c i)) 1 (fun _ => 0) (physicalBoxCell_nonempty lo N P hPpos c) q g x) ≤ R) (hbad : ((integerBoxUniformWeights paramLo paramHi hparam).prod (integerBoxUniformWeights sourceLo sourceHi hsource)).eventProbability (physicalMeshCrossing lo N P (fun tz => (integerBoxMesh sourceLo sourceHi S tz.2, integerBoxMesh paramLo paramHi T tz.1)) (fun tz => smoothAffineSample (fun j => a j + (D : ℤ) * (tz.1 j).val) (fun i => (tz.2 i).val))) ≤ beta) : ((integerBoxUniformWeights paramLo paramHi hparam).prod (integerBoxUniformWeights sourceLo sourceHi hsource)).mean (fun tz => w (fun i => (tz.2 i).val) * (physicalBoxTruncation lo N P hPpos q b h (smoothAffineSample (fun j => a j + (D : ℤ) * (tz.1 j).val) (fun i => (tz.2 i).val)) - r * physicalBoxTruncation lo N P hPpos q b g (smoothAffineSample (fun j => a j + (D : ℤ) * (tz.1 j).val) (fun i => (tz.2 i).val)))) ≤ R + (1 + r) * (etaParam + beta) * residueTruncationCap ι b etaSite := by let : Nonempty (∀ i, Finset.Ico (sourceLo i) (sourceHi i)) := ⟨fun i => ⟨sourceLo i, Finset.mem_Ico.mpr ⟨le_rfl, hsource i⟩⟩⟩ let : Nonempty (∀ j, Finset.Ico (paramLo j) (paramHi j)) := ⟨fun j => ⟨paramLo j, Finset.mem_Ico.mpr ⟨le_rfl, hparam j⟩⟩⟩ let ps := FiniteProbabilityWeights.uniform (∀ i, Finset.Ico (sourceLo i) (sourceHi i)) let pt := FiniteProbabilityWeights.uniform (∀ j, Finset.Ico (paramLo j) (paramHi j)) let p := pt.prod ps let ms := integerBoxMesh sourceLo sourceHi S let mt := integerBoxMesh paramLo paramHi T let mesh := fun tz : (∀ j, Finset.Ico (paramLo j) (paramHi j)) × (∀ i, Finset.Ico (sourceLo i) (sourceHi i)) => (ms tz.2, mt tz.1) let location := fun tz : (∀ j, Finset.Ico (paramLo j) (paramHi j)) × (∀ i, Finset.Ico (sourceLo i) (sourceHi i)) => smoothAffineSample (fun j => a j + (D : ℤ) * (tz.1 j).val) (fun i => (tz.2 i).val) let bad := physicalMeshCrossing lo N P mesh location let value := fun (z : Option J × I → ℤ) (t : J → ℤ) => w z * (physicalBoxTruncation lo N P hPpos q b h (smoothAffineSample (fun j => a j + (D : ℤ) * t j) z) - r * physicalBoxTruncation lo N P hPpos q b g (smoothAffineSample (fun j => a j + (D : ℤ) * t j) z)) let F := fun tz : (∀ j, Finset.Ico (paramLo j) (paramHi j)) × (∀ i, Finset.Ico (sourceLo i) (sourceHi i)) => value (fun i => (tz.2 i).val) (fun j => (tz.1 j).val) let cap := residueTruncationCap ι b etaSite let K := R + (1 + r) * etaParam * cap have hcap0 : 0 ≤ cap := residueTruncationCap_nonneg ι b hetaSite have hK : 0 ≤ K := by dsimp only [K]; positivity have hsLaw : integerBoxUniformWeights sourceLo sourceHi hsource = ps := integerBoxUniformWeights_eq_uniform sourceLo sourceHi hsource have htLaw : integerBoxUniformWeights paramLo paramHi hparam = pt := integerBoxUniformWeights_eq_uniform paramLo paramHi hparam rw [hsLaw, htLaw] at hbad ⊢ change p.eventProbability bad ≤ beta at hbad change p.mean F ≤ R + (1 + r) * (etaParam + beta) * cap have hlocal (x) (hx : ¬ bad x) : finiteCellMean p mesh F (mesh x) ≤ K * (finiteCellWeights p mesh).weight (mesh x) := by let cs := ms x.2 let ct := mt x.1 have hclass := retained_integer_mesh_boxes_classify lo N P sourceLo sourceHi S hSstep hSpos paramLo paramHi T hTstep hTpos D a x hx have hwcell (z) (hz : z ∈ translatedIntegerBox (fun i => intervalCellLower (sourceLo i) (S i) (cs i)) (fun i => (S i).length (cs i))) : 0 ≤ w z ∧ w z ≤ 1 := by obtain ⟨y, _, hy⟩ := integerBoxMesh_cell_realize sourceLo sourceHi S hSstep hSpos cs z hz simpa only [hy] using hw y have havg : (𝔼 z : IntegerResidueBox (fun i => intervalCellLower (sourceLo i) (S i) (cs i)) (fun i => intervalCellLower (sourceLo i) (S i) (cs i) + (S i).length (cs i)) (fun _ => 1) (fun _ => 0), 𝔼 t : IntegerResidueBox (fun j => intervalCellLower (paramLo j) (T j) (ct j)) (fun j => intervalCellLower (paramLo j) (T j) (ct j) + (T j).length (ct j)) (fun _ => 1) (fun _ => 0), value (fun i => (z i).val) (fun j => (t j).val)) ≤ K := by cases hc : physicalBoxClassify lo N P (location x) with | some c => have ht := retained_physical_truncation_difference_le lo N P hPstep hPpos c q (fun i => intervalCellLower (sourceLo i) (S i) (cs i)) (fun i => (S i).length (cs i)) (physicalBoxCell_nonempty sourceLo (fun i => (sourceHi i - sourceLo i).toNat) S hSpos cs) (fun j => intervalCellLower (paramLo j) (T j) (ct j)) (fun j => (T j).length (ct j)) (physicalBoxCell_nonempty paramLo (fun j => (paramHi j - paramLo j).toNat) T hTpos ct) D a b w h g hwcell hh hg (fun z hz t ht => (hclass z hz t ht).trans hc) hetaParam hetaSite hr (hcloseParam ct) (hcloseSite c) (hreference cs c) simpa only [value, K, cap, ← Finset.mul_expect] using ht | none => have he (z : IntegerResidueBox (fun i => intervalCellLower (sourceLo i) (S i) (cs i)) (fun i => intervalCellLower (sourceLo i) (S i) (cs i) + (S i).length (cs i)) (fun _ => 1) (fun _ => 0)) (t : IntegerResidueBox (fun j => intervalCellLower (paramLo j) (T j) (ct j)) (fun j => intervalCellLower (paramLo j) (T j) (ct j) + (T j).length (ct j)) (fun _ => 1) (fun _ => 0)) : value (fun i => (z i).val) (fun j => (t j).val) = 0 := by have hnone := (hclass (fun i => (z i).val) ((mem_translatedIntegerBox _ _ _).mpr (fun i => Finset.mem_Ico.mp (Finset.mem_filter.mp (z i).property).1)) (fun j => (t j).val) ((mem_translatedIntegerBox _ _ _).mpr (fun j => Finset.mem_Ico.mp (Finset.mem_filter.mp (t j).property).1))).trans hc dsimp only [value] rw [physicalBoxTruncation_of_classify_none lo N P hPpos q b h _ hnone, physicalBoxTruncation_of_classify_none lo N P hPpos q b g _ hnone] ring simpa only [he, Finset.expect_const_zero] using hK have hm := integerBoxMesh_pair_cell_mean sourceLo sourceHi S hSstep hSpos paramLo paramHi T hTstep hTpos cs ct value have hwgt := finiteCellWeights_product ps pt ms mt cs ct change finiteCellMean p mesh F (cs,ct) ≤ K * (finiteCellWeights p mesh).weight (cs,ct) rw [hm, hwgt] exact (mul_le_mul_of_nonneg_left havg (mul_nonneg ((finiteCellWeights ps ms).nonneg cs) ((finiteCellWeights pt mt).nonneg ct))).trans_eq (mul_comm _ _) have hbound (x) (_ : bad x) : |F x| ≤ (1 + r) * cap := by have hhc := physicalBoxTruncation_cap lo N P hPstep hPpos q b h hh hetaSite hcloseSite (location x) have hgc := physicalBoxTruncation_cap lo N P hPstep hPpos q b g hg hetaSite hcloseSite (location x) have hd : |physicalBoxTruncation lo N P hPpos q b h (location x) - r * physicalBoxTruncation lo N P hPpos q b g (location x)| ≤ (1 + r) * cap := by apply (abs_sub _ _).trans rw [abs_mul, abs_of_nonneg hr] exact (add_le_add hhc (mul_le_mul_of_nonneg_left hgc hr)).trans_eq (by dsimp only [cap]; ring) change |w (fun i => (x.2 i).val) * (physicalBoxTruncation lo N P hPpos q b h (location x) - r * physicalBoxTruncation lo N P hPpos q b g (location x))| ≤ _ rw [abs_mul, abs_of_nonneg (hw x.2).1] exact (mul_le_mul (hw x.2).2 hd (abs_nonneg _) zero_le_one).trans_eq (one_mul _) have hall := finite_mean_le_of_retained_cells p mesh bad F (fun x y hxy => physicalMeshCrossing_congr lo N P mesh location hxy) hK (by positivity : 0 ≤ (1 + r) * cap) hbad hbound hlocal exact hall.trans_eq (by dsimp only [K]; ring)
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
theorem affine_mesh_zero_extension_bound {ι I J : Type*} [Fintype ι] [DecidableEq ι] [Fintype I] [Fintype J] (lo : I → ℤ) (N : I → ℕ) (P : ∀ i, FiniteProgressionPartition (N i)) (hPstep : ∀ i c, (P i).step c = 1) (hPpos : ∀ i c, 0 < (P i).length c) (sourceLo sourceHi : Option J × I → ℤ) (hsource : ∀ i, sourceLo i < sourceHi i) (S : ∀ i, FiniteProgressionPartition (sourceHi i - sourceLo i).toNat) (hSstep : ∀ i c, (S i).step c = 1) (hSpos : ∀ i c, 0 < (S i).length c) (paramLo paramHi : J → ℤ) (hparam : ∀ j, paramLo j < paramHi j) (T : ∀ j, FiniteProgressionPartition (paramHi j - paramLo j).toNat) (hTstep : ∀ j c, (T j).step c = 1) (hTpos : ∀ j c, 0 < (T j).length c) (D : ℕ) (a : J → ℤ) (q : ι → ℕ) [∀ i, NeZero (q i)] (b : ℕ) (w : (Option J × I → ℤ) → ℝ) (h g : (I → ℤ) → ℝ) (hw : ∀ z : (∀ i, Finset.Ico (sourceLo i) (sourceHi i)), 0 ≤ w (fun i => (z i).val) ∧ w (fun i => (z i).val) ≤ 1) (hh : ∀ x ∈ translatedIntegerBox lo N, 0 ≤ h x ∧ h x ≤ 1) (hg : ∀ x ∈ translatedIntegerBox lo N, 0 ≤ g x ∧ g x ≤ 1) {etaParam etaSite r R beta accuracy : ℝ} (hetaParam : 0 ≤ etaParam) (hetaSite : 0 ≤ etaSite) (hr : 0 ≤ r) (hR : 0 ≤ R) (hcloseParam : ∀ ct : (∀ j, (T j).Label), ProductMarginalsClose (primeCoordinateReference (σ := J) q) (residuePrimeCoordinateDensity (fun j => intervalCellLower (paramLo j) (T j) (ct j)) (fun j => (T j).length (ct j)) 1 (fun _ => 0) (physicalBoxCell_nonempty paramLo (fun j => (paramHi j - paramLo j).toNat) T hTpos ct) q (fun _ => 1)) etaParam b) (hcloseSite : ∀ c : (∀ i, (P i).Label), ProductMarginalsClose (primeCoordinateReference (σ := I) q) (residuePrimeCoordinateDensity (fun i => intervalCellLower (lo i) (P i) (c i)) (fun i => (P i).length (c i)) 1 (fun _ => 0) (physicalBoxCell_nonempty lo N P hPpos c) q (fun _ => 1)) etaSite b) (hreference : ∀ cs : (∀ i, (S i).Label), ∀ c : (∀ i, (P i).Label), productTruncatedPairing (affinePeriodProductCoupling (σ := I) q D a) (lowDegreeCoordinateSets ι b) (residuePrimeCoordinateDensity (fun i => intervalCellLower (sourceLo i) (S i) (cs i)) (fun i => (S i).length (cs i)) 1 (fun _ => 0) (physicalBoxCell_nonempty sourceLo (fun i => (sourceHi i - sourceLo i).toNat) S hSpos cs) q w) (fun x => residuePrimeCoordinateDensity (fun i => intervalCellLower (lo i) (P i) (c i)) (fun i => (P i).length (c i)) 1 (fun _ => 0) (physicalBoxCell_nonempty lo N P hPpos c) q h x - r * residuePrimeCoordinateDensity (fun i => intervalCellLower (lo i) (P i) (c i)) (fun i => (P i).length (c i)) 1 (fun _ => 0) (physicalBoxCell_nonempty lo N P hPpos c) q g x) ≤ R) (hbad : ((integerBoxUniformWeights paramLo paramHi hparam).prod (integerBoxUniformWeights sourceLo sourceHi hsource)).eventProbability (physicalMeshCrossing lo N P (fun tz => (integerBoxMesh sourceLo sourceHi S tz.2, integerBoxMesh paramLo paramHi T tz.1)) (fun tz => smoothAffineSample (fun j => a j + (D : ℤ) * (tz.1 j).val) (fun i => (tz.2 i).val))) ≤ beta) (heh : |((integerBoxUniformWeights paramLo paramHi hparam).prod (integerBoxUniformWeights sourceLo sourceHi hsource)).mean (fun tz => w (fun i => (tz.2 i).val) * physicalBoxResidual lo N P hPpos q b h (smoothAffineSample (fun j => a j + (D : ℤ) * (tz.1 j).val) (fun i => (tz.2 i).val)))| ≤ accuracy) (heg : |((integerBoxUniformWeights paramLo paramHi hparam).prod (integerBoxUniformWeights sourceLo sourceHi hsource)).mean (fun tz => w (fun i => (tz.2 i).val) * physicalBoxResidual lo N P hPpos q b g (smoothAffineSample (fun j => a j + (D : ℤ) * (tz.1 j).val) (fun i => (tz.2 i).val)))| ≤ accuracy) : ((integerBoxUniformWeights paramLo paramHi hparam).prod (integerBoxUniformWeights sourceLo sourceHi hsource)).mean (fun tz => w (fun i => (tz.2 i).val) * (realZeroExtendFinset (translatedIntegerBox lo N) h (smoothAffineSample (fun j => a j + (D : ℤ) * (tz.1 j).val) (fun i => (tz.2 i).val)) - r * realZeroExtendFinset (translatedIntegerBox lo N) g (smoothAffineSample (fun j => a j + (D : ℤ) * (tz.1 j).val) (fun i => (tz.2 i).val)))) ≤ R + (1 + r) * ((etaParam + beta) * residueTruncationCap ι b etaSite + accuracy) := by have hlow := affine_mesh_truncation_bound lo N P hPstep hPpos sourceLo sourceHi hsource S hSstep hSpos paramLo paramHi hparam T hTstep hTpos D a q b w h g hw hh hg hetaParam hetaSite hr hR hcloseParam hcloseSite hreference hbad have hrestore := physical_zero_extension_restore_difference ((integerBoxUniformWeights paramLo paramHi hparam).prod (integerBoxUniformWeights sourceLo sourceHi hsource)) (fun tz => smoothAffineSample (fun j => a j + (D : ℤ) * (tz.1 j).val) (fun i => (tz.2 i).val)) (fun tz => w (fun i => (tz.2 i).val)) lo N P hPstep hPpos q b h g hr heh heg hlow exact hrestore.trans_eq (by ring)
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
theorem affine_mesh_scalar_tail {ι I J : Type*} [Fintype ι] [DecidableEq ι] [Fintype I] [Fintype J] (lo : I → ℤ) (N : I → ℕ) (P : ∀ i, FiniteProgressionPartition (N i)) (hPstep : ∀ i c, (P i).step c = 1) (hPpos : ∀ i c, 0 < (P i).length c) (sourceLo sourceHi : Option J × I → ℤ) (hsource : ∀ i, sourceLo i < sourceHi i) (S : ∀ i, FiniteProgressionPartition (sourceHi i - sourceLo i).toNat) (hSstep : ∀ i c, (S i).step c = 1) (hSpos : ∀ i c, 0 < (S i).length c) (paramLo paramHi : J → ℤ) (hparam : ∀ j, paramLo j < paramHi j) (T : ∀ j, FiniteProgressionPartition (paramHi j - paramLo j).toNat) (hTstep : ∀ j c, (T j).step c = 1) (hTpos : ∀ j c, 0 < (T j).length c) (D : ℕ) (a : J → ℤ) (q : ι → ℕ) [∀ i, NeZero (q i)] (b : ℕ) (h g : (I → ℤ) → ℝ) (hh : ∀ x ∈ translatedIntegerBox lo N, 0 ≤ h x ∧ h x ≤ 1) (hg : ∀ x ∈ translatedIntegerBox lo N, 0 ≤ g x ∧ g x ≤ 1) {etaParam etaSite r R beta accuracy : ℝ} (hetaParam : 0 ≤ etaParam) (hetaSite : 0 ≤ etaSite) (hr : 0 ≤ r) (hR : 0 ≤ R) (hcloseParam : ∀ ct : (∀ j, (T j).Label), ProductMarginalsClose (primeCoordinateReference (σ := J) q) (residuePrimeCoordinateDensity (fun j => intervalCellLower (paramLo j) (T j) (ct j)) (fun j => (T j).length (ct j)) 1 (fun _ => 0) (physicalBoxCell_nonempty paramLo (fun j => (paramHi j - paramLo j).toNat) T hTpos ct) q (fun _ => 1)) etaParam b) (hcloseSite : ∀ c : (∀ i, (P i).Label), ProductMarginalsClose (primeCoordinateReference (σ := I) q) (residuePrimeCoordinateDensity (fun i => intervalCellLower (lo i) (P i) (c i)) (fun i => (P i).length (c i)) 1 (fun _ => 0) (physicalBoxCell_nonempty lo N P hPpos c) q (fun _ => 1)) etaSite b) (hreference : ∀ w : (Option J × I → ℤ) → ℝ, (∀ z : (∀ i, Finset.Ico (sourceLo i) (sourceHi i)), 0 ≤ w (fun i => (z i).val) ∧ w (fun i => (z i).val) ≤ 1) → ∀ cs : (∀ i, (S i).Label), ∀ c : (∀ i, (P i).Label), productTruncatedPairing (affinePeriodProductCoupling (σ := I) q D a) (lowDegreeCoordinateSets ι b) (residuePrimeCoordinateDensity (fun i => intervalCellLower (sourceLo i) (S i) (cs i)) (fun i => (S i).length (cs i)) 1 (fun _ => 0) (physicalBoxCell_nonempty sourceLo (fun i => (sourceHi i - sourceLo i).toNat) S hSpos cs) q w) (fun x => residuePrimeCoordinateDensity (fun i => intervalCellLower (lo i) (P i) (c i)) (fun i => (P i).length (c i)) 1 (fun _ => 0) (physicalBoxCell_nonempty lo N P hPpos c) q h x - r * residuePrimeCoordinateDensity (fun i => intervalCellLower (lo i) (P i) (c i)) (fun i => (P i).length (c i)) 1 (fun _ => 0) (physicalBoxCell_nonempty lo N P hPpos c) q g x) ≤ R) (hbad : ((integerBoxUniformWeights paramLo paramHi hparam).prod (integerBoxUniformWeights sourceLo sourceHi hsource)).eventProbability (physicalMeshCrossing lo N P (fun tz => (integerBoxMesh sourceLo sourceHi S tz.2, integerBoxMesh paramLo paramHi T tz.1)) (fun tz => smoothAffineSample (fun j => a j + (D : ℤ) * (tz.1 j).val) (fun i => (tz.2 i).val))) ≤ beta) (heh : ∀ w : (Option J × I → ℤ) → ℝ, (∀ z : (∀ i, Finset.Ico (sourceLo i) (sourceHi i)), 0 ≤ w (fun i => (z i).val) ∧ w (fun i => (z i).val) ≤ 1) → |((integerBoxUniformWeights paramLo paramHi hparam).prod (integerBoxUniformWeights sourceLo sourceHi hsource)).mean (fun tz => w (fun i => (tz.2 i).val) * physicalBoxResidual lo N P hPpos q b h (smoothAffineSample (fun j => a j + (D : ℤ) * (tz.1 j).val) (fun i => (tz.2 i).val)))| ≤ accuracy) (heg : ∀ w : (Option J × I → ℤ) → ℝ, (∀ z : (∀ i, Finset.Ico (sourceLo i) (sourceHi i)), 0 ≤ w (fun i => (z i).val) ∧ w (fun i => (z i).val) ≤ 1) → |((integerBoxUniformWeights paramLo paramHi hparam).prod (integerBoxUniformWeights sourceLo sourceHi hsource)).mean (fun tz => w (fun i => (tz.2 i).val) * physicalBoxResidual lo N P hPpos q b g (smoothAffineSample (fun j => a j + (D : ℤ) * (tz.1 j).val) (fun i => (tz.2 i).val)))| ≤ accuracy) (p dominationLog : ℝ) (outer : FiniteProbabilityWeights (∀ i, Finset.Ico (sourceLo i) (sourceHi i))) (hdom : ∀ z, outer.weight z ≤ Real.exp dominationLog * (integerBoxUniformWeights sourceLo sourceHi hsource).weight z) (herror : R + (1 + r) * ((etaParam + beta) * residueTruncationCap ι b etaSite + accuracy) ≤ Real.exp (-(2 * p + dominationLog)) / 2) : outer.eventProbability (fun z => Real.exp (-p) < (integerBoxUniformWeights paramLo paramHi hparam).mean (fun t => realZeroExtendFinset (translatedIntegerBox lo N) h (smoothAffineSample (fun j => a j + (D : ℤ) * (t j).val) (fun i => (z i).val)) - r * realZeroExtendFinset (translatedIntegerBox lo N) g (smoothAffineSample (fun j => a j + (D : ℤ) * (t j).val) (fun i => (z i).val)))) ≤ Real.exp (-p) := by apply fixedParameter_observed_tail_dominated (integerBoxUniformWeights sourceLo sourceHi hsource) outer (integerBoxUniformWeights paramLo paramHi hparam) (fun z i => (z i).val) (fun t z => realZeroExtendFinset (translatedIntegerBox lo N) h (smoothAffineSample (fun j => a j + (D : ℤ) * (t j).val) z) - r * realZeroExtendFinset (translatedIntegerBox lo N) g (smoothAffineSample (fun j => a j + (D : ℤ) * (t j).val) z)) p dominationLog hdom intro w hw exact (affine_mesh_zero_extension_bound lo N P hPstep hPpos sourceLo sourceHi hsource S hSstep hSpos paramLo paramHi hparam T hTstep hTpos D a q b w h g hw hh hg hetaParam hetaSite hr hR hcloseParam hcloseSite (hreference w hw) hbad (heh w hw) (heg w hw)).trans herror
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243import OAI.Combinatorics.Progressions.Fourier.AffineTorusGeometryimport OAI.Combinatorics.Progressions.Lattices.WeightedSliceIntegerImage
namespace OAI
section
namespace Erdos3
open scoped NNReal
noncomputable def affinePrimitiveEnvelope (I : Type*) [Fintype I] (A B T : ℝ≥0) (M V : ℕ) : ℝ := max 1 (max (scalarCubePrimitiveEnvelope I A B T M) (max (scalarCubePrimitiveEnvelope Empty A B T M) ((V * M : ℕ) : ℝ)))
theorem affinePrimitiveEnvelope_one_le (I : Type*) [Fintype I] (A B T : ℝ≥0) (M V : ℕ) : 1 ≤ affinePrimitiveEnvelope I A B T M V := le_max_left _ _
theorem affinePrimitiveEnvelope_vector (I : Type*) [Fintype I] [DecidableEq I] (s : NormalizedScalarCubeSource I) (A B T : ℝ≥0) (M V : ℕ) (hM : s.modulusBound ≤ M) (hB : s.weightBound ≤ B) (hT : s.weightLipschitz ≤ T) : ScalarCubePrimitiveBudget s A (affinePrimitiveEnvelope I A B T M V) := (scalarCubePrimitiveBudget_of_raw_bounds s A B T M hM hB hT).mono ((le_max_left _ _).trans (le_max_right _ _))
theorem affinePrimitiveEnvelope_coefficient (I : Type*) [Fintype I] (s : NormalizedScalarCubeSource Empty) (A B T : ℝ≥0) (M V : ℕ) (hM : s.modulusBound ≤ M) (hB : s.weightBound ≤ B) (hT : s.weightLipschitz ≤ T) : ScalarCubePrimitiveBudget s A (affinePrimitiveEnvelope I A B T M V) := (scalarCubePrimitiveBudget_of_raw_bounds s A B T M hM hB hT).mono ((le_max_left _ _).trans ((le_max_right _ _).trans (le_max_right _ _)))
theorem affinePrimitiveEnvelope_stride (I : Type*) [Fintype I] (A B T : ℝ≥0) (M V : ℕ) {v m : ℕ} (hv : v ≤ V) (hm : m ≤ M) : ((v * m : ℕ) : ℝ) ≤ affinePrimitiveEnvelope I A B T M V := by have hvm : ((v * m : ℕ) : ℝ) ≤ ((V * M : ℕ) : ℝ) := by exact_mod_cast Nat.mul_le_mul hv hm exact hvm.trans ((le_max_right _ _).trans ((le_max_right _ _).trans (le_max_right _ _)))
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators NNReal Classical
theorem affineCube_geometric_approximation {B I : Type*} [Fintype B] [Nonempty B] [DecidableEq B] [Fintype I] [DecidableEq I] {n K : ℕ} [NeZero K] (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) (u : B → Fin (n + 1) → Option I → ℤ) (v : B → Fin (n + 1) → Option I → ℕ) (A W T : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (M V : ℕ) (hM : ∀ b j, (s b j).modulusBound ≤ M) (hW : ∀ b j, (s b j).weightBound ≤ W) (hT : ∀ b j, (s b j).weightLipschitz ≤ T) (hv : ∀ b j i, 0 < v b j i) (hvV : ∀ b j i, v b j i ≤ V) {C F D E ε : ℝ} (hC : 0 ≤ C) (hD : 0 ≤ D) (hE : 0 ≤ E) (hε : 0 < ε) (hε1 : ε ≤ 1) (hcoord : ∀ b j i, |(u b j i : ℝ)| + (v b j i : ℝ) * (s b j).length ≤ C * (s b j).length) (hupper : ∀ b, (∏ j, ((s b j).length : ℝ)) ≤ F * K) (hlower : ∀ b, (K : ℝ) ≤ D * ∏ j, ((s b j).length : ℝ)) (p : ℕ) (hpower : ∀ b j, (K : ℝ) ≤ E * ((s b j).length : ℝ) ^ p) (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n + 1) (hB : uniformSpectrumBlockCount n J.card (p * J.card) ≤ Fintype.card B) : let U := affinePrimitiveEnvelope I A W T M V let Q := affineTorusRadius (Fintype.card I) (n + 1) (Fintype.card B) C F let R := affineTorusFactor (Fintype.card I) (n + 1) (Fintype.card B) C F let ζ := uniformBlockRetainedBias n J.card (p * J.card) U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) ε ∃ S : Finset (J → Fin (R * K)), (S.card : ℝ) ≤ uniformSpectrumSizeConstant n J.card (p * J.card) U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) / ε ^ max (majorArcSpectrumExponent n J.card) (majorArcLengthExponent n * (p * J.card)) ∧ (∑ k, ‖∏ b, affineWeightedCubeGridCoefficient (s b) (fun j i => (u b j i : ℝ)) (v b) (R * K) J k‖) ≤ uniformSpectrumAbsoluteCap n J.card (p * J.card) U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) ∧ (∀ k ∈ S, ∃ d : ℕ, 0 < d ∧ (d : ℝ) ≤ uniformCharacterDenominatorBound n J.card (p * J.card) U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) ζ ∧ ∃ (a : J → ℤ) (ξ : J → ℝ), (∀ Z, |ξ Z| ≤ 2 * majorArcCoverConstant n J.card U ((R : ℝ) * D) / ζ ^ majorArcCoverExponent n J.card) ∧ ∀ Z, ((k Z).val : ℝ) / (R * K) = (a Z : ℝ) / d + ξ Z / K) ∧ ∀ center z : J → ℤ, centeredFundamentalBox Q K center z → ‖(((K : ℝ) ^ J.card * finiteImageMass (weightedCubeIntegerSource s) (affineWeightedCubeIntegerSum s u v J center) z : ℝ) : ℂ) - integerGridApproximation (weightedCubeIntegerSource s) (affineWeightedCubeIntegerSum s u v J center) K (R * K) S z‖ ≤ ε := by let U := affinePrimitiveEnvelope I A W T M V let Q := affineTorusRadius (Fintype.card I) (n + 1) (Fintype.card B) C F let R := affineTorusFactor (Fintype.card I) (n + 1) (Fintype.card B) C F have hU : 1 ≤ U := affinePrimitiveEnvelope_one_le I A W T M V have h (b) (j) : ScalarCubePrimitiveBudget (s b j) A U := affinePrimitiveEnvelope_vector I (s b j) A W T M V (hM b j) (hW b j) (hT b j) have hstride (b) (j) (i) : ((v b j i * (s b j).modulus i : ℕ) : ℝ) ≤ U := affinePrimitiveEnvelope_stride I A W T M V (hvV b j i) ((s b j).modulus_le i |>.trans (hM b j)) have hK : 0 < K := Nat.pos_of_ne_zero (NeZero.ne K) have hR : 0 < R := affineTorusFactor_pos _ _ _ _ _ obtain ⟨m, hm, hmin, hsize⟩ := exists_scaled_grid_minimum (fun x : B × Fin (n + 1) => (s x.1 x.2).length) (fun x => (s x.1 x.2).length_pos) (R := R) p J.card (fun x => hpower x.1 x.2) have hVD : 0 ≤ (R : ℝ) * D := by positivity have hWE : 0 ≤ ((R : ℝ) * E) ^ J.card := by positivity have hscale (b : B) : ((R * K : ℕ) : ℝ) / ∏ j, ((s b j).length : ℝ) ≤ (R : ℝ) * D := by have hp : 0 < ∏ j, ((s b j).length : ℝ) := Finset.prod_pos (fun j _ => by exact_mod_cast (s b j).length_pos) simpa only [Nat.cast_mul] using scaled_grid_volume_bound (Nat.cast_nonneg R) hp (hlower b) let ζ := uniformBlockRetainedBias n J.card (p * J.card) U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) ε let S := uniformBlockSpectrumCover J (R * K) n U ((R : ℝ) * D) (m : ℝ) ζ refine ⟨S, ?_, ?_, ?_, ?_⟩ · simpa only [S, ζ, Fintype.card_coe] using uniformBlockSpectrumCover_polynomial_card J (R * K) n (p * J.card) hU hVD hWE (Nat.cast_nonneg m) hε hε1 (by simpa only [Fintype.card_coe] using hsize) · exact (affine_weightedCube_uniform_spectrum s (fun b j i => (u b j i : ℝ)) v A hA hU hVD hWE (Nat.cast_nonneg m) hε h (fun b j => by exact_mod_cast hmin (b, j)) hv hstride (R * K) (p * J.card) (Nat.mul_pos hR hK) J hJ hB hsize hscale).2 · intro k hk obtain ⟨hζ, hζ1, _⟩ := uniformBlockRetainedBias_spec n J.card (p * J.card) hU hWE hε obtain ⟨d, hd, hdb, a, ξ, hξ, he⟩ := uniformBlockSpectrumCover_character (Nat.mul_pos hR hK) n (p * J.card) hU hVD hWE (Nat.cast_nonneg m) hζ hζ1 (by simpa only [Fintype.card_coe] using hsize) k hk obtain ⟨ρ, hρ, hρe⟩ := grid_character_rescale hR k a ξ hξ (by simpa only [Nat.cast_mul] using he) refine ⟨d, hd, ?_, a, ρ, ?_, hρe⟩ · simpa only [Fintype.card_coe] using hdb · simpa only [Fintype.card_coe] using hρ · exact affine_weightedCube_fundamental_approximation s u v A hA hU hVD hWE (Nat.cast_nonneg m) hε h (fun b j => by exact_mod_cast hmin (b, j)) hv hstride (p * J.card) J hJ (fun Z => affineWeightedCube_bound_le_torus s u v hC hcoord hupper Z (hJ Z Z.property)) hB hsize hscale
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators NNReal Classical
theorem affineModerate_geometric_approximation {B I : Type*} [Fintype B] [Nonempty B] [DecidableEq B] [Fintype I] [DecidableEq I] {n K : ℕ} [NeZero K] (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I) (offset : B → ℤ) (stride : B → ℕ) (u : B → Fin n → Option I → ℤ) (v : B → Fin n → Option I → ℕ) (A W T : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (M V : ℕ) (hcM : ∀ b, (c b).modulusBound ≤ M) (hcW : ∀ b, (c b).weightBound ≤ W) (hcT : ∀ b, (c b).weightLipschitz ≤ T) (hM : ∀ b j, (s b j).modulusBound ≤ M) (hW : ∀ b j, (s b j).weightBound ≤ W) (hT : ∀ b j, (s b j).weightLipschitz ≤ T) (hv : ∀ b j i, 0 < v b j i) (hvV : ∀ b j i, v b j i ≤ V) (ht : ∀ b, 0 < stride b) (htV : ∀ b, stride b ≤ V) {C F D E ε : ℝ} (hC : 0 ≤ C) (hD : 0 ≤ D) (hE : 0 ≤ E) (hε : 0 < ε) (hε1 : ε ≤ 1) (hcoord : ∀ b j i, |(u b j i : ℝ)| + (v b j i : ℝ) * (s b j).length ≤ C * (s b j).length) (hupper : ∀ b, (|(offset b : ℝ)| + (stride b : ℝ) * (c b).length) * (∏ j, ((s b j).length : ℝ)) ≤ F * K) (hlower : ∀ b, (K : ℝ) ≤ D * ((c b).length * ∏ j, ((s b j).length : ℝ))) (p : ℕ) (hpower : ∀ b j, (K : ℝ) ≤ E * ((s b j).length : ℝ) ^ p) (hcpower : ∀ b, (K : ℝ) ≤ E * ((c b).length : ℝ) ^ p) (J : Finset (Finset I)) (hJ : ∀ S ∈ J, S.card ≤ n) (hB : uniformSpectrumBlockCount n J.card (p * J.card) ≤ Fintype.card B) : let U := affinePrimitiveEnvelope I A W T M V let Q := affineTorusRadius (Fintype.card I) n (Fintype.card B) C F let R := affineTorusFactor (Fintype.card I) n (Fintype.card B) C F let ζ := uniformBlockRetainedBias n J.card (p * J.card) U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) ε ∃ S : Finset (J → Fin (R * K)), (S.card : ℝ) ≤ uniformSpectrumSizeConstant n J.card (p * J.card) U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) / ε ^ max (majorArcSpectrumExponent n J.card) (majorArcLengthExponent n * (p * J.card)) ∧ (∑ k, ‖∏ b, affineWeightedModerateGridCoefficient (c b) (s b) (offset b : ℝ) (stride b) (fun j i => (u b j i : ℝ)) (v b) (R * K) J k‖) ≤ uniformSpectrumAbsoluteCap n J.card (p * J.card) U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) ∧ (∀ k ∈ S, ∃ d : ℕ, 0 < d ∧ (d : ℝ) ≤ uniformCharacterDenominatorBound n J.card (p * J.card) U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) ζ ∧ ∃ (a : J → ℤ) (ξ : J → ℝ), (∀ Z, |ξ Z| ≤ 2 * majorArcCoverConstant n J.card U ((R : ℝ) * D) / ζ ^ majorArcCoverExponent n J.card) ∧ ∀ Z, ((k Z).val : ℝ) / (R * K) = (a Z : ℝ) / d + ξ Z / K) ∧ ∀ center z : J → ℤ, centeredFundamentalBox Q K center z → ‖(((K : ℝ) ^ J.card * finiteImageMass (weightedModerateIntegerProductSource c s) (affineWeightedModerateIntegerSum c s offset stride u v J center) z : ℝ) : ℂ) - integerGridApproximation (weightedModerateIntegerProductSource c s) (affineWeightedModerateIntegerSum c s offset stride u v J center) K (R * K) S z‖ ≤ ε := by let U := affinePrimitiveEnvelope I A W T M V let R := affineTorusFactor (Fintype.card I) n (Fintype.card B) C F have hU : 1 ≤ U := affinePrimitiveEnvelope_one_le I A W T M V have hc (b) : ScalarCubePrimitiveBudget (c b) A U := affinePrimitiveEnvelope_coefficient I (c b) A W T M V (hcM b) (hcW b) (hcT b) have h (b) (j) : ScalarCubePrimitiveBudget (s b j) A U := affinePrimitiveEnvelope_vector I (s b j) A W T M V (hM b j) (hW b j) (hT b j) have hstride (b) (j) (i) : ((v b j i * (s b j).modulus i : ℕ) : ℝ) ≤ U := affinePrimitiveEnvelope_stride I A W T M V (hvV b j i) ((s b j).modulus_le i |>.trans (hM b j)) have hcoeff (b) : ((stride b * (c b).modulus none : ℕ) : ℝ) ≤ U := affinePrimitiveEnvelope_stride I A W T M V (htV b) ((c b).modulus_le none |>.trans (hcM b)) have hK : 0 < K := Nat.pos_of_ne_zero (NeZero.ne K) have hR : 0 < R := affineTorusFactor_pos _ _ _ _ _ let length (x : B × Option (Fin n)) : ℕ := x.2.elim (c x.1).length (fun j => (s x.1 j).length) have hpos (x : B × Option (Fin n)) : 0 < length x := by rcases x with ⟨b, _ | j⟩ · exact (c b).length_pos · exact (s b j).length_pos have hpow (x : B × Option (Fin n)) : (K : ℝ) ≤ E * (length x : ℝ) ^ p := by rcases x with ⟨b, _ | j⟩ · exact hcpower b · exact hpower b j obtain ⟨m, hm, hmin, hsize⟩ := exists_scaled_grid_minimum length hpos (R := R) p J.card hpow have hVD : 0 ≤ (R : ℝ) * D := by positivity have hWE : 0 ≤ ((R : ℝ) * E) ^ J.card := by positivity have hscale (b : B) : ((R * K : ℕ) : ℝ) / ((((stride b * (c b).modulus none : ℕ) : ℝ) * (c b).length) * ∏ j, ((s b j).length : ℝ)) ≤ (R : ℝ) * D := by have hp : 0 < (((stride b * (c b).modulus none : ℕ) : ℝ) * (c b).length) * ∏ j, ((s b j).length : ℝ) := by apply mul_pos · exact mul_pos (by exact_mod_cast Nat.mul_pos (ht b) ((c b).modulus_pos none)) (by exact_mod_cast (c b).length_pos) · exact Finset.prod_pos (fun j _ => by exact_mod_cast (s b j).length_pos) simpa only [Nat.cast_mul] using scaled_grid_volume_bound (Nat.cast_nonneg R) hp (affineModerate_physical_volume_lower (c b) (s b) (ht b) hD (hlower b)) let ζ := uniformBlockRetainedBias n J.card (p * J.card) U ((R : ℝ) * D) (((R : ℝ) * E) ^ J.card) ε let S := uniformBlockSpectrumCover J (R * K) n U ((R : ℝ) * D) (m : ℝ) ζ refine ⟨S, ?_, ?_, ?_, ?_⟩ · simpa only [S, ζ, Fintype.card_coe] using uniformBlockSpectrumCover_polynomial_card J (R * K) n (p * J.card) hU hVD hWE (Nat.cast_nonneg m) hε hε1 (by simpa only [Fintype.card_coe] using hsize) · exact (affine_weightedModerate_uniform_spectrum c s (fun b => (offset b : ℝ)) stride (fun b j i => (u b j i : ℝ)) v A hA hU hVD hWE (Nat.cast_nonneg m) hε hc h (fun b => by exact_mod_cast hmin (b, none)) (fun b j => by exact_mod_cast hmin (b, some j)) ht hv hstride hcoeff (R * K) (p * J.card) (Nat.mul_pos hR hK) J hJ hB hsize hscale).2 · intro k hk obtain ⟨hζ, hζ1, _⟩ := uniformBlockRetainedBias_spec n J.card (p * J.card) hU hWE hε obtain ⟨d, hd, hdb, a, ξ, hξ, he⟩ := uniformBlockSpectrumCover_character (Nat.mul_pos hR hK) n (p * J.card) hU hVD hWE (Nat.cast_nonneg m) hζ hζ1 (by simpa only [Fintype.card_coe] using hsize) k hk obtain ⟨ρ, hρ, hρe⟩ := grid_character_rescale hR k a ξ hξ (by simpa only [Nat.cast_mul] using he) refine ⟨d, hd, ?_, a, ρ, ?_, hρe⟩ · simpa only [Fintype.card_coe] using hdb · simpa only [Fintype.card_coe] using hρ · exact affine_weightedModerate_fundamental_approximation c s offset stride u v A hA hU hVD hWE (Nat.cast_nonneg m) hε hc h (fun b => by exact_mod_cast hmin (b, none)) (fun b j => by exact_mod_cast hmin (b, some j)) ht hv hstride hcoeff (p * J.card) J hJ (fun Z => affineWeightedModerate_bound_le_torus c s offset stride u v hC hcoord hupper Z (hJ Z Z.property)) hB hsize hscale
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492import OAI.Combinatorics.Progressions.Fourier.FixedPrincipalCoefficientSpectrumimport OAI.Combinatorics.Progressions.Probability.AllocatedActiveAxisSourceLaw
namespace OAI
section
namespace Erdos3
open scoped BigOperators NNReal
variable {A J : Type*} [Fintype A] [Fintype J]variable (D : A → ℕ) [∀ a, NeZero (D a)] (frequency : A → J → ℤ)variable (coefficient : A → ℂ) (mode : A → (J → ℝ) → ℂ)
noncomputable def finiteResidueModeModel (residue : ∀ a, J → ZMod (D a)) (x : J → ℝ) : ℂ := ∑ a, coefficient a * (star (rationalGridPhase (D a) (frequency a) (residue a)) * mode a x)
theorem finiteResidueModeModel_norm {C : ℝ} (hcap : (∑ a, ‖coefficient a‖) ≤ C) (hmode : ∀ a x, ‖mode a x‖ ≤ 1) (residue : ∀ a, J → ZMod (D a)) (x : J → ℝ) : ‖finiteResidueModeModel D frequency coefficient mode residue x‖ ≤ C := by apply (norm_sum_le _ _).trans apply (Finset.sum_le_sum (fun a _ => ?_)).trans hcap rw [norm_mul, norm_mul, norm_star, rationalGridPhase_norm, one_mul] exact mul_le_of_le_one_right (norm_nonneg _) (hmode a x)
theorem finiteResidueModeModel_lipschitz (C L : ℝ≥0) (hcap : (∑ a, ‖coefficient a‖) ≤ C) (hmode : ∀ a, LipschitzWith L (mode a)) (residue : ∀ a, J → ZMod (D a)) : LipschitzWith (C * L) (finiteResidueModeModel D frequency coefficient mode residue) := by apply LipschitzWith.of_dist_le_mul intro x y rw [dist_eq_norm] unfold finiteResidueModeModel rw [← Finset.sum_sub_distrib] calc _ ≤ ∑ a, ‖coefficient a * (star (rationalGridPhase (D a) (frequency a) (residue a)) * mode a x) - coefficient a * (star (rationalGridPhase (D a) (frequency a) (residue a)) * mode a y)‖ := norm_sum_le _ _ _ ≤ ∑ a, ‖coefficient a‖ * ((L : ℝ) * dist x y) := by apply Finset.sum_le_sum intro a _ rw [← mul_sub, ← mul_sub, norm_mul, norm_mul, norm_star, rationalGridPhase_norm, one_mul] exact mul_le_mul_of_nonneg_left (by simpa only [dist_eq_norm] using (hmode a).dist_le_mul x y) (norm_nonneg _) _ = (∑ a, ‖coefficient a‖) * ((L : ℝ) * dist x y) := (Finset.sum_mul _ _ _).symm _ ≤ (C : ℝ) * ((L : ℝ) * dist x y) := mul_le_mul_of_nonneg_right hcap (mul_nonneg L.coe_nonneg dist_nonneg) _ = _ := by rw [NNReal.coe_mul, mul_assoc]
theorem finiteResidueModeModel_residue_card [DecidableEq A] [DecidableEq J] (Q : ℕ) (hQ : ∀ a, D a ≤ Q) : Fintype.card (∀ a, J → ZMod (D a)) ≤ Q ^ (Fintype.card A * Fintype.card J) := by classical rw [Fintype.card_pi] simp only [Fintype.card_fun, ZMod.card] calc ∏ a, D a ^ Fintype.card J ≤ ∏ _a : A, Q ^ Fintype.card J := Finset.prod_le_prod (fun a _ => Nat.pow_le_pow_left (hQ a) _) _ = Q ^ (Fintype.card A * Fintype.card J) := by simp only [Finset.prod_const, Finset.card_univ, ← pow_mul, Nat.mul_comm]
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classicalopen CircleFourier
noncomputable def weightedAffineModerateIntegerBlock {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] (c : NormalizedScalarCubeSource Empty) (s : Fin n → NormalizedScalarCubeSource I) (u : Fin n → Option I → ℤ) (v : Fin n → Option I → ℕ) (J : Finset (Finset I)) (offset : ℤ) (x : IntegerScalarCubeBox Empty c.length × (∀ j, IntegerScalarCubeBox I (s j).length)) : J → ℤ := fun S => (offset + (x.1 none : ℤ)) * integerBooleanBlockJet (fun j => affineIntegerCubeCoordinates (u j) (v j) (fun r => (x.2 j r : ℤ))) S
theorem weightedAffineModerateGridCoefficient_eq_image {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] (c : NormalizedScalarCubeSource Empty) (s : Fin n → NormalizedScalarCubeSource I) (u : Fin n → Option I → ℤ) (v : Fin n → Option I → ℕ) (M : ℕ) [NeZero M] (J : Finset (Finset I)) (offset : ℤ) (k : J → Fin M) : integerGridCoefficient (weightedModerateIntegerSource c s) (weightedAffineModerateIntegerBlock c s u v J offset) M k = weightedAffineModerateGridCoefficient c s (fun j i => (u j i : ℝ)) v (offset : ℝ) M J k := by unfold integerGridCoefficient weightedModerateIntegerSource rw [FiniteProbabilityWeights.complexMean_prod] change c.source.complexMean _ = c.source.complexMean _ congr 1 funext z congr 1 funext x rw [rectangularGridCharacter_eq] simp only [weightedAffineModerateIntegerBlock, integerBooleanBlockJet_scaled_pairing] simp only [affineIntegerCubeCoordinates, Int.cast_add, Int.cast_mul, Int.cast_natCast] rfl
noncomputable def weightedAffineModerateIntegerJetSum {B : Type*} [Fintype B] {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I) (u : B → Fin n → Option I → ℤ) (v : B → Fin n → Option I → ℕ) (J : Finset (Finset I)) (offset : B → ℤ) (shift : J → ℤ) (x : ��� b, IntegerScalarCubeBox Empty (c b).length × (∀ j, IntegerScalarCubeBox I (s b j).length)) : J → ℤ := shift + ∑ b, weightedAffineModerateIntegerBlock (c b) (s b) (u b) (v b) J (offset b) (x b)
theorem weightedAffineModerateIntegerJetSum_coefficient {B : Type*} [Fintype B] [DecidableEq B] {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I) (u : B → Fin n → Option I → ℤ) (v : B → Fin n → Option I → ℕ) (M : ℕ) [NeZero M] (J : Finset (Finset I)) (offset : B → ℤ) (shift : J → ℤ) (k : J → Fin M) : integerGridCoefficient (weightedModerateIntegerProductSource c s) (weightedAffineModerateIntegerJetSum c s u v J offset shift) M k = rectangularGridCharacter M k shift * ∏ b, weightedAffineModerateGridCoefficient (c b) (s b) (fun j i => (u b j i : ℝ)) (v b) (offset b : ℝ) M J k := by have h := independent_integerGridCoefficient (fun b => weightedModerateIntegerSource (c b) (s b)) (fun b => weightedAffineModerateIntegerBlock (c b) (s b) (u b) (v b) J (offset b)) shift M k unfold weightedModerateIntegerProductSource weightedAffineModerateIntegerJetSum simpa only [weightedAffineModerateGridCoefficient_eq_image] using h
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
theorem containedProgressionCoordinate_mem {L H step : ℕ} (c z : ℤ) (hsubset : integerProgressionSupport c (step : ℤ) H ⊆ Finset.Ico (0 : ℤ) (L : ℤ)) (hz : z ∈ Finset.Ico (0 : ℤ) (H : ℤ)) : c + (step : ℤ) * z ∈ Finset.Ico (0 : ℤ) (L : ℤ) := by apply hsubset rw [integerProgressionSupport, mem_translateSupport] exact Finset.mem_image.mpr ⟨z, hz, by change (step : ℤ) * z = _; ring⟩
theorem NormalizedScalarCubeSource.source_cube {I : Type*} [Fintype I] [DecidableEq I] (s : NormalizedScalarCubeSource I) (x : IntegerScalarCubeBox I s.length) (hx : s.source.weight x ≠ 0) : IntegerScalarCube s.length (fun i => (x i : ℤ)) := by have hb : s.baseLaw.weight x ≠ 0 := (mul_ne_zero_iff.mp hx).1 have hp := lt_of_le_of_ne (s.baseLaw.nonneg x) hb.symm rw [NormalizedScalarCubeSource.baseLaw, scalarCubeResidueWeights, FiniteProbabilityWeights.condition_weight_pos_iff] at hp have h1 := hp.2 rw [integerScalarCubeWeights, FiniteProbabilityWeights.condition_weight_pos_iff] at h1 exact (mem_integerScalarCubeSet s.length x).mp h1.1
theorem containedProgressionCoordinate_bound {I : Type*} [Fintype I] [DecidableEq I] {L H step : ℕ} (c : ℤ) (hsubset : integerProgressionSupport c (step : ℤ) H ⊆ Finset.Ico (0 : ℤ) (L : ℤ)) (x : IntegerScalarCubeBox I H) (hx : IntegerScalarCube H (fun i => (x i : ℤ))) (i : Option I) : |(if i = none then c else 0) + (step : ℤ) * (x i : ℤ)| ≤ L := by have hb := integerScalarCube_coordinates (integerScalarCube_progression c hsubset _ hx) i exact abs_le.mpr ⟨hb.1.le, hb.2.le⟩
theorem weightedAffineModerateIntegerJetSum_box_bound {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] {n : ℕ} (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I) (u : B → Fin n → Option I → ℤ) (v : B → Fin n → Option I → ℕ) (T : ℕ) (rows : Finset (Finset I)) (hrows : ∀ t ∈ rows, t.card ≤ n) {A K : ℝ} (hA : 0 ≤ A) (hK : 0 ≤ K) (hvol : ∀ b, ((c b).length : ℝ) * (T : ℝ) ^ n ≤ A * K) (shift : rows → ℤ) (x : ∀ b, IntegerScalarCubeBox Empty (c b).length × (∀ j, IntegerScalarCubeBox I (s b j).length)) (hcoord : ∀ b j i, |affineIntegerCubeCoordinates (u b j) (v b j) (fun i => ((x b).2 j i : ℤ)) i| ≤ T) (t : rows) : |(weightedAffineModerateIntegerJetSum c s u v rows (fun _ => 0) shift x t : ℝ) - shift t| ≤ blockJetScaleBound (Fintype.card I) n (Fintype.card B) A * K := by have hb (b : B) : |weightedAffineModerateIntegerBlock (c b) (s b) (u b) (v b) rows 0 (x b) t| ≤ ((c b).length : ℤ) * ((2 : ℤ) ^ t.val.card * ∏ _j : Fin n, ((Fintype.card I + 1 : ℕ) : ℤ) * T) := by unfold weightedAffineModerateIntegerBlock rw [zero_add, abs_mul] exact mul_le_mul (integerScalarCubeBox_coordinate_abs (x b).1 none) (integerBooleanBlockJet_bound _ (fun _ => T) (fun j i => hcoord b j i) t) (abs_nonneg _) (Nat.cast_nonneg _) have hs : |weightedAffineModerateIntegerJetSum c s u v rows (fun _ => 0) shift x t - shift t| ≤ ∑ b, ((c b).length : ℤ) * ((2 : ℤ) ^ t.val.card * ∏ _j : Fin n, ((Fintype.card I + 1 : ℕ) : ℤ) * T) := by simp only [weightedAffineModerateIntegerJetSum, Pi.add_apply, Finset.sum_apply, add_sub_cancel_left] exact (Finset.abs_sum_le_sum_abs _ _).trans (Finset.sum_le_sum (fun b _ => hb b)) have hs' : |(weightedAffineModerateIntegerJetSum c s u v rows (fun _ => 0) shift x t : ℝ) - shift t| ≤ ∑ b, ((c b).length : ℝ) * ((2 : ℝ) ^ t.val.card * (((Fintype.card I + 1 : ℕ) : ℝ) ^ n * (T : ℝ) ^ n)) := by have hh : |(weightedAffineModerateIntegerJetSum c s u v rows (fun _ => 0) shift x t : ℝ) - shift t| ≤ ∑ b, ((c b).length : ℝ) * ((2 : ℝ) ^ t.val.card * ∏ _j : Fin n, ((Fintype.card I + 1 : ℕ) : ℝ) * T) := by exact_mod_cast hs simpa only [Finset.prod_mul_distrib, Finset.prod_const, Finset.card_univ, Fintype.card_fin] using hh apply hs'.trans calc _ = ∑ b, (2 : ℝ) ^ t.val.card * ((Fintype.card I + 1 : ℕ) : ℝ) ^ n * (((c b).length : ℝ) * (T : ℝ) ^ n) := by apply Finset.sum_congr rfl intro b _ ring _ ≤ ∑ _b : B, (2 : ℝ) ^ n * ((Fintype.card I + 1 : ℕ) : ℝ) ^ n * (A * K) := by apply Finset.sum_le_sum intro b _ apply (mul_le_mul_of_nonneg_left (hvol b) (by positivity)).trans have hp := pow_le_pow_right₀ (by norm_num : (1 : ℝ) ≤ 2) (hrows t t.property) exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hp (by positivity)) (mul_nonneg hA hK) _ = _ := by simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, blockJetScaleBound] ring
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
variable {B : Type*} [Fintype B] [DecidableEq B]variable {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I]variable (c : B → NormalizedScalarCubeSource Empty)variable (s : B → Fin n → NormalizedScalarCubeSource I)
theorem weightedAffineModerateProductSource_jet_sum_law (u : B → Fin n → Option I → ℤ) (v : B → Fin n → Option I → ℕ) (J : Finset (Finset I)) (offset : B → ℤ) (shift : J → ℤ) : ((weightedModerateIntegerProductSource c s).toPMF).map (weightedAffineModerateIntegerJetSum c s u v J offset shift) = (dependentProductPMF (fun b => (c b).source.toPMF.map (fun x => (x none : ℤ)))).bind (fun a => (dependentProductPMF (fun b => (dependentProductPMF (fun j => (s b j).source.toPMF)).map (fun y j q => (y j q : ℤ)))).map (fun y => shift + ∑ b, fun r : J => (offset b + a b) * integerBooleanBlockJet (fun j => affineIntegerCubeCoordinates (u b j) (v b j) (y b j)) r)) := by have hp := congrArg (fun p : PMF (B → ℤ × (Fin n → Option I → ℤ)) => p.map (fun z => shift + ∑ b, fun r : J => (offset b + (z b).1) * integerBooleanBlockJet (fun j => affineIntegerCubeCoordinates (u b j) (v b j) ((z b).2 j)) r)) (weightedModerateProductSource_pair_law c s) rw [PMF.map_comp, PMF.map_bind] at hp change ((weightedModerateIntegerProductSource c s).toPMF).map (fun x => shift + ∑ b, fun r : J => (offset b + ((x b).1 none : ℤ)) * integerBooleanBlockJet (fun j => affineIntegerCubeCoordinates (u b j) (v b j) (fun q => ((x b).2 j q : ℤ))) r) = _ simpa only [PMF.map_comp, Function.comp_def] using hp
theorem weightedAffineModerateProductSource_affine_law (u : B → Fin n → Option I → ℤ) (v : B → Fin n → Option I → ℕ) (J : Finset (Finset I)) (offset : B → ℤ) (shift : J → ℤ) : (weightedModerateIntegerProductSource c s).toPMF.map (weightedAffineModerateIntegerJetSum c s u v J offset shift) = (dependentProductPMF (fun b => (c b).source.toPMF.map (fun x => (x none : ℤ)))).bind (fun a => (dependentProductPMF (fun b => (dependentProductPMF (fun j => (s b j).source.toPMF)).map (fun y j => affineIntegerCubeCoordinates (u b j) (v b j) (fun i => (y j i : ℤ))))).map (fun y => shift + ∑ b, fun r : J => (offset b + a b) * integerBooleanBlockJet (y b) r)) := by have hm := dependentProductPMF_map (fun b => (dependentProductPMF (fun j => (s b j).source.toPMF)).map (fun y j i => (y j i : ℤ))) (fun b y j => affineIntegerCubeCoordinates (u b j) (v b j) (y j)) simp only [PMF.map_comp, Function.comp_def] at hm have ht := congrArg (fun p : PMF (B → Fin n → Option I → ℤ) => (dependentProductPMF (fun b => (c b).source.toPMF.map (fun x => (x none : ℤ)))).bind (fun a => p.map (fun y => shift + ∑ b, fun r : J => (offset b + a b) * integerBooleanBlockJet (y b) r))) hm refine (weightedAffineModerateProductSource_jet_sum_law c s u v J offset shift).trans ?_ simpa only [PMF.map_comp, Function.comp_def] using ht
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
theorem affineWeightedCubeIntegerSum_box_bound {B I : Type*} [Fintype B] [Fintype I] [DecidableEq I] {n : ℕ} (s : B → Fin (n + 1) → NormalizedScalarCubeSource I) (u : B → Fin (n + 1) → Option I → ℤ) (v : B → Fin (n + 1) → Option I → ℕ) (T : ℕ) (rows : Finset (Finset I)) (hrows : ∀ t ∈ rows, t.card ≤ n + 1) {A K : ℝ} (hA : 0 ≤ A) (hK : 0 ≤ K) (hvol : (T : ℝ) ^ (n + 1) ≤ A * K) (shift : rows → ℤ) (x : ∀ b j, IntegerScalarCubeBox I (s b j).length) (hcoord : ∀ b j i, |affineIntegerCubeCoordinates (u b j) (v b j) (fun i => (x b j i : ℤ)) i| ≤ T) (t : rows) : |(affineWeightedCubeIntegerSum s u v rows shift x t : ℝ) - shift t| ≤ blockJetScaleBound (Fintype.card I) (n + 1) (Fintype.card B) A * K := by have hs : |affineWeightedCubeIntegerSum s u v rows shift x t - shift t| ≤ ∑ _b : B, (2 : ℤ) ^ t.val.card * ∏ _j : Fin (n + 1), ((Fintype.card I + 1 : ℕ) : ℤ) * T := by simp only [affineWeightedCubeIntegerSum, Pi.add_apply, Finset.sum_apply, add_sub_cancel_left] apply (Finset.abs_sum_le_sum_abs _ _).trans exact Finset.sum_le_sum (fun b _ => integerBooleanBlockJet_bound _ (fun _ => T) (fun j i => hcoord b j i) t) have hs' : |(affineWeightedCubeIntegerSum s u v rows shift x t : ℝ) - shift t| ≤ ∑ _b : B, (2 : ℝ) ^ t.val.card * (((Fintype.card I + 1 : ℕ) : ℝ) ^ (n + 1) * (T : ℝ) ^ (n + 1)) := by have hh : |(affineWeightedCubeIntegerSum s u v rows shift x t : ℝ) - shift t| ≤ ∑ _b : B, (2 : ℝ) ^ t.val.card * ∏ _j : Fin (n + 1), ((Fintype.card I + 1 : ℕ) : ℝ) * T := by exact_mod_cast hs simpa only [Finset.prod_mul_distrib, Finset.prod_const, Finset.card_univ, Fintype.card_fin] using hh apply hs'.trans calc _ ≤ ∑ _b : B, (2 : ℝ) ^ (n + 1) * ((Fintype.card I + 1 : ℕ) : ℝ) ^ (n + 1) * (A * K) := by apply Finset.sum_le_sum intro b _ rw [← mul_assoc] apply (mul_le_mul_of_nonneg_left hvol (by positivity)).trans exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right (pow_le_pow_right₀ (by norm_num : (1 : ℝ) ≤ 2) (hrows t t.property)) (by positivity)) (mul_nonneg hA hK) _ = _ := by simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul, blockJetScaleBound] ring
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators NNReal Classical
noncomputable def weightedAffineModerateGridApproximation {B : Type*} [Fintype B] {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I) (u : B → Fin n → Option I → ℤ) (v : B → Fin n → Option I → ℕ) (K M : ℕ) [NeZero M] (J : Finset (Finset I)) (offset : B → ℤ) (shift z : J → ℤ) (S : Finset (J → Fin M)) : ℂ := ((K : ℂ) / M) ^ J.card * ∑ k ∈ S, (∏ b, weightedAffineModerateGridCoefficient (c b) (s b) (fun j i => (u b j i : ℝ)) (v b) (offset b : ℝ) M J k) * (rectangularGridCharacter M k shift * star (rectangularGridCharacter M k z))
theorem weightedAffineModerateGridDensity_fourier {B : Type*} [Fintype B] [DecidableEq B] {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I) (u : B → Fin n → Option I → ℤ) (v : B → Fin n → Option I → ℕ) (K M : ℕ) [NeZero M] (J : Finset (Finset I)) (offset : B → ℤ) (shift z : J → ℤ) : (integerGridDensity (weightedModerateIntegerProductSource c s) (weightedAffineModerateIntegerJetSum c s u v J offset shift) K M z : ℂ) = weightedAffineModerateGridApproximation c s u v K M J offset shift z Finset.univ := by rw [integerGridDensity_fourier] simp only [weightedAffineModerateGridApproximation, Fintype.card_coe] congr 1 apply Finset.sum_congr rfl intro k _ rw [weightedAffineModerateIntegerJetSum_coefficient] ring
theorem weightedAffineModerateGridDensity_error_of_tail {B : Type*} [Fintype B] [DecidableEq B] {n : ℕ} {I : Type*} [Fintype I] [DecidableEq I] (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I) (u : B → Fin n → Option I → ℤ) (v : B → Fin n → Option I → ℕ) (K M : ℕ) [NeZero M] (J : Finset (Finset I)) (offset : B → ℤ) (S : Finset (J → Fin M)) {ε : ℝ} (htail : spectrumTail S (fun k => ‖∏ b, weightedAffineModerateGridCoefficient (c b) (s b) (fun j i => (u b j i : ℝ)) (v b) (offset b : ℝ) M J k‖) ≤ ε) (shift z : J → ℤ) : ‖(integerGridDensity (weightedModerateIntegerProductSource c s) (weightedAffineModerateIntegerJetSum c s u v J offset shift) K M z : ℂ) - weightedAffineModerateGridApproximation c s u v K M J offset shift z S‖ ≤ ((K : ℝ) / M) ^ J.card * ε := by let ψ k := rectangularGridCharacter M k shift * star (rectangularGridCharacter M k z) have hψ k : ‖ψ k‖ ≤ 1 := by simp only [ψ, norm_mul, norm_star, rectangularGridCharacter_norm, one_mul, le_refl] have hb := (finite_series_truncation_le S (fun k => ∏ b, weightedAffineModerateGridCoefficient (c b) (s b) (fun j i => (u b j i : ℝ)) (v b) (offset b : ℝ) M J k) ψ hψ).trans htail rw [weightedAffineModerateGridDensity_fourier] unfold weightedAffineModerateGridApproximation rw [← mul_sub, norm_mul, norm_pow, norm_div, Complex.norm_natCast, Complex.norm_natCast] exact mul_le_mul_of_nonneg_left hb (by positivity)
end Erdos3
end
section
namespace Erdos3
open MeasureTheoryopen scoped BigOperators Classical NNReal
variable {B I T : Type*} [Fintype B] [Fintype I] [DecidableEq I]variable [Countable T] [MeasurableSpace T] [MeasurableSingletonClass T]variable {n K M : ℕ} [NeZero M]variable (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin n → NormalizedScalarCubeSource I)variable (u : B → Fin n → Option I → ℤ) (v : B → Fin n → Option I → ℕ)variable (offset : B → ℤ)
noncomputable def weightedAffineModeratePlateauApproximation (K : ℕ) (H : ℝ) (rows : Finset (Finset I)) (shift z : rows → ℤ) (F : Finset (rows → Fin M)) : ℂ := (normalizedSupportPlateau H (fun t => ((z t : ℝ) - shift t) / K) : ℂ) * weightedAffineModerateGridApproximation c s u v K M rows offset shift z F
theorem weightedAffineModeratePlateauApproximation_split_periods (hK : 0 < K) (H : ℝ) (rows : Finset (Finset I)) (shift z : rows → ℤ) (F : Finset (rows → Fin M)) (D : (rows → Fin M) → ℕ) [∀ k, NeZero (D k)] (a : (rows → Fin M) → rows → ℤ) (ω : (rows → Fin M) → rows → ℝ) (hfreq : ∀ k ∈ F, ∀ t, ((k t).val : ℝ) / M = (a k t : ℝ) / D k + ω k t / K) : weightedAffineModeratePlateauApproximation c s u v offset K H rows shift z F = ((K : ℂ) / M) ^ rows.card * ∑ k ∈ F, (∏ b, weightedAffineModerateGridCoefficient (c b) (s b) (fun j i => (u b j i : ℝ)) (v b) (offset b : ℝ) M rows k) * (rationalGridPhase (D k) (a k) (integerGridResidue (D k) (shift - z)) * plateauFourierMode H (fun t => -ω k t) (fun t => ((z t : ℝ) - shift t) / K)) := by unfold weightedAffineModeratePlateauApproximation weightedAffineModerateGridApproximation simp only [Finset.mul_sum] apply Finset.sum_congr rfl intro k hk rw [← plateau_grid_character_split H hK k (a k) (ω k) (hfreq k hk) shift z] ring
theorem weightedAffineModeratePlateauMixture_expansion (p : PMF T) (hK : 0 < K) (H : ℝ) (rows : Finset (Finset I)) (shift : T → rows → ℤ) (z : rows → ℤ) (F : Finset (rows → Fin M)) (D : (rows → Fin M) → ℕ) [∀ k, NeZero (D k)] (a : (rows → Fin M) → rows → ℤ) (ω : (rows → Fin M) → rows → ℝ) (hfreq : ∀ k ∈ F, ∀ t, ((k t).val : ℝ) / M = (a k t : ℝ) / D k + ω k t / K) : (∫ zeta, weightedAffineModeratePlateauApproximation c s u v offset K H rows (shift zeta) z F ∂p.toMeasure) = ((K : ℂ) / M) ^ rows.card * ∑ k ∈ F, (∏ b, weightedAffineModerateGridCoefficient (c b) (s b) (fun j i => (u b j i : ℝ)) (v b) (offset b : ℝ) M rows k) * (star (rationalGridPhase (D k) (a k) (integerGridResidue (D k) z)) * plateauModeMixture p H (D k) K (a k) (ω k) shift (fun t => (z t : ℝ) / K)) := by simp_rw [weightedAffineModeratePlateauApproximation_split_periods c s u v offset hK H rows _ z F D a ω hfreq] rw [integral_const_mul, integral_finsetSum] · congr 1 apply Finset.sum_congr rfl intro k _ rw [integral_const_mul, plateauModeMixture_grid_factor] · intro k _ apply Integrable.const_mul apply pmf_integrable_of_norm_le p _ (B := 1) intro zeta rw [norm_mul, rationalGridPhase_norm, one_mul] exact plateauFourierMode_norm _ _ _
noncomputable def weightedAffinePlateauModeCoefficient (K M : ℕ) (rows : Finset (Finset I)) (k : rows → Fin M) : ℂ := ((K : ℂ) / M) ^ rows.card * ∏ b, weightedAffineModerateGridCoefficient (c b) (s b) (fun j i => (u b j i : ℝ)) (v b) (offset b : ℝ) M rows k
omit [NeZero M] intheorem weightedAffinePlateauModeCoefficient_sum_le (rows : Finset (Finset I)) (F : Finset (rows → Fin M)) (hscale : ((K : ℝ) / M) ^ rows.card ≤ 1) {C : ℝ} (hcap : (∑ k, ‖∏ b, weightedAffineModerateGridCoefficient (c b) (s b) (fun j i => (u b j i : ℝ)) (v b) (offset b : ℝ) M rows k‖) ≤ C) : (∑ k : F, ‖weightedAffinePlateauModeCoefficient c s u v offset K M rows k‖) ≤ C := by rw [← Finset.sum_subtype F (fun _ => Iff.rfl) (fun k => ‖weightedAffinePlateauModeCoefficient c s u v offset K M rows k‖)] simp only [weightedAffinePlateauModeCoefficient, norm_mul, norm_pow, norm_div, Complex.norm_natCast, ← Finset.mul_sum] have hC : 0 ≤ C := (Finset.sum_nonneg (fun _ _ => norm_nonneg _)).trans hcap apply (mul_le_mul_of_nonneg_left ((Finset.sum_le_univ_sum_of_nonneg (fun _ => norm_nonneg _)).trans hcap) (by positivity)).trans exact mul_le_of_le_one_left hC hscale
noncomputable def weightedAffinePlateauModeModel (p : PMF T) (H : ℝ) (K : ℕ) (rows : Finset (Finset I)) (F : Finset (rows → Fin M)) (D : (rows → Fin M) → ℕ) [∀ k, NeZero (D k)] (a : (rows → Fin M) → rows → ℤ) (ω : (rows → Fin M) → rows → ℝ) (shift : T → rows → ℤ) (residue : ∀ k : F, rows → ZMod (D k)) (x : rows → ℝ) : ℂ := finiteResidueModeModel (fun k : F => D k) (fun k => a k) (fun k => weightedAffinePlateauModeCoefficient c s u v offset K M rows k) (fun k => plateauModeMixture p H (D k) K (a k) (ω k) shift) residue x
theorem weightedAffinePlateauModeModel_grid_value (p : PMF T) (hK : 0 < K) (H : ℝ) (rows : Finset (Finset I)) (F : Finset (rows → Fin M)) (D : (rows → Fin M) → ℕ) [∀ k, NeZero (D k)] (a : (rows → Fin M) → rows → ℤ) (ω : (rows → Fin M) → rows → ℝ) (hfreq : ∀ k ∈ F, ∀ t, ((k t).val : ℝ) / M = (a k t : ℝ) / D k + ω k t / K) (shift : T → rows → ℤ) (z : rows → ℤ) : (∫ zeta, weightedAffineModeratePlateauApproximation c s u v offset K H rows (shift zeta) z F ∂p.toMeasure) = weightedAffinePlateauModeModel c s u v offset p H K rows F D a ω shift (fun k => integerGridResidue (D k) z) (fun t => (z t : ℝ) / K) := by rw [weightedAffineModeratePlateauMixture_expansion c s u v offset p hK H rows shift z F D a ω hfreq] let term (k : rows → Fin M) := weightedAffinePlateauModeCoefficient c s u v offset K M rows k * (star (rationalGridPhase (D k) (a k) (integerGridResidue (D k) z)) * plateauModeMixture p H (D k) K (a k) (ω k) shift (fun t => (z t : ℝ) / K)) calc _ = ∑ k ∈ F, term k := by simp only [term, weightedAffinePlateauModeCoefficient, Finset.mul_sum, mul_assoc] _ = ∑ k : F, term k := Finset.sum_subtype F (fun _ => Iff.rfl) term _ = _ := rfl
end Erdos3
end
end OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364import OAI.Combinatorics.Progressions.Estimates.WeightedPlateauSiteApproximation
namespace OAI
section
namespace Erdos3
open MeasureTheoryopen scoped BigOperators Classical NNReal
variable {B α T : Type*} [Fintype B] [Fintype α] [DecidableEq α]variable [Countable T] [MeasurableSpace T] [MeasurableSingletonClass T]variable {b K M : ℕ} [NeZero M]
theorem exists_weighted_affine_plateau_site_approximation (c : B → NormalizedScalarCubeSource Empty) (s : B → Fin b → NormalizedScalarCubeSource α) (u : B → Fin b → Option α → ℤ) (v : B → Fin b → Option α → ℕ) (offset : B → ℤ) (p : PMF T) (hK : 0 < K) (H : ℝ) (rows : Finset (Finset α)) (F : Finset (rows → Fin M)) (D : (rows → Fin M) → ℕ) [∀ k, NeZero (D k)] (a : (rows → Fin M) → rows → ℤ) (ω : (rows → Fin M) → rows → ℝ) (hfreq : ∀ k ∈ F, ∀ t, ((k t).val : ℝ) / M = (a k t : ℝ) / D k + ω k t / K) (shift : T → rows → ℤ) (hscale : ((K : ℝ) / M) ^ rows.card ≤ 1) {C : ℝ} (hcap : (∑ k, ‖∏ b, weightedAffineModerateGridCoefficient (c b) (s b) (fun j i => (u b j i : ℝ)) (v b) (offset b : ℝ) M rows k‖) ≤ C) (W : ℝ≥0) (hW : ∀ k ∈ F, ∀ t, |ω k t| ≤ W) {R δ P : ℝ} (hR : 0 < R) (hδ : 0 < δ) (hP : 0 ≤ P) (hRP : R ≤ Real.exp P) (hδP : (δ / (C + 1))⁻¹ ≤ Real.exp P) (hLP : ((CircleFourier.characterLipConstant * (rows.card * W) + 4) * (2 : ℝ≥0) ^ Fintype.card α : ℝ≥0) ≤ Real.exp P) : ∃ n : F → ℕ, (∀ k, (n k : ℝ) ≤ Real.exp (4 * P + 8)) ∧ (Fintype.card (PlateauSiteIndex α F n) : ℝ) ≤ F.card * Real.exp (Fintype.card (Finset α) * (4 * P + 8)) ∧ ∃ (β : PlateauSiteIndex α F n → ℂ) (f : (k : PlateauSiteIndex α F n) → Finset α → ZMod (D k.1) → ℝ → ℂ), (∑ k, ‖β k‖) ≤ C * Real.exp (Fintype.card (Finset α) * (4 * P + 8) + P) ∧ (∀ k u r x, ‖f k u r x‖ ≤ 1) ∧ (∀ k u r, LipschitzWith ⟨Real.exp (1 + 6 * P + 12), Real.exp_nonneg _⟩ (f k u r)) ∧ ∀ y : Finset α → ℤ, (∀ u, |(y u : ℝ) / K| ≤ R) → ‖(∫ zeta, weightedAffineModeratePlateauApproximation c s u v offset K H rows (shift zeta) (fun t => booleanCoefficient y t) F ∂p.toMeasure) - ∑ k, β k * ∏ u, f k u (y u : ZMod (D k.1)) ((y u : ℝ) / K)‖ ≤ δ := by have hC : 0 ≤ C := (Finset.sum_nonneg (fun _ _ => norm_nonneg _)).trans hcap have htol : 0 < δ / (C + 1) := div_pos hδ (by positivity) obtain ⟨n, hn, hcard, β, f, hβ, hf, hLf, he⟩ := exists_integer_plateau_sum_site_approximation p H K rows (fun k : F => D k) (fun k => a k) (fun k => ω k) shift (fun k => weightedAffinePlateauModeCoefficient c s u v offset K M rows k) (weightedAffinePlateauModeCoefficient_sum_le c s u v offset rows F hscale hcap) W (fun k => hW k k.property) hR htol hP hRP hδP hLP refine ⟨n, hn, ?_, β, f, hβ, hf, hLf, ?_⟩ · simpa only [Fintype.card_coe] using hcard · intro y hy rw [weightedAffinePlateauModeModel_grid_value c s u v offset p hK H rows F D a ω hfreq shift] apply (he y hy).trans rw [← mul_div_assoc] apply (div_le_iff₀ (by positivity : 0 < C + 1)).mpr nlinarith
end Erdos3
end
end OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849import OAI.Combinatorics.Progressions.Estimates.NormalizedMeshLengths
namespace OAI
section
namespace Erdos3
theorem affinePhysicalScales_lower {H L Q : ℝ} {exponent : ℕ} (hL : 1 ≤ L) (hQ : 0 ≤ Q) (hexponent : 1 ≤ exponent) (hH : Q * L ^ exponent ≤ H) : Q ≤ H ∧ Q ≤ H / L := by have hpower : L ≤ L ^ exponent := by simpa only [pow_one] using pow_le_pow_right₀ hL hexponent have hQL : Q * L ≤ H := (mul_le_mul_of_nonneg_left hpower hQ).trans hH have hLpos : 0 < L := lt_of_lt_of_le zero_lt_one hL refine ⟨?_, (le_div_iff₀ hLpos).mpr hQL⟩ exact (by nlinarith : Q ≤ Q * L).trans hQL
theorem affineParameterScale_lower {L Q P : ℝ} {D : ℕ} (hD : 0 < D) (hQ : 0 ≤ Q) (hDlog : (D : ℝ) ≤ Real.exp P) (hL : Q * Real.exp P ≤ L) : Q ≤ L / (D : ℝ) := by apply (le_div_iff₀ (by exact_mod_cast hD : (0 : ℝ) < D)).mpr exact (mul_le_mul_of_nonneg_left hDlog hQ).trans hL
theorem affineNormalizedScales_lower {I J : Type*} (H : I → ℝ) {L inverseLog lengthLog parameterLog : ℝ} {D exponent : ℕ} (hL : 1 ≤ L) (hD : 0 < D) (hexponent : 1 ≤ exponent) (hDlog : (D : ℝ) ≤ Real.exp parameterLog) (hparam : 4 * Real.exp (inverseLog + lengthLog + parameterLog) ≤ L) (hsite : ∀ i, 4 * Real.exp (inverseLog + lengthLog) * L ^ exponent ≤ H i) : (∀ i, 4 * Real.exp (inverseLog + lengthLog) ≤ H i) ∧ (∀ z : Option J × I, 4 * Real.exp (inverseLog + lengthLog) ≤ smoothPairCoefficientScale (H z.2) L z.1) ∧ 4 * Real.exp (inverseLog + lengthLog) ≤ L / (D : ℝ) := by have hQ : 0 ≤ 4 * Real.exp (inverseLog + lengthLog) := by positivity have hs (i) := affinePhysicalScales_lower hL hQ hexponent (hsite i) refine ⟨fun i => (hs i).1, ?_, ?_⟩ · rintro ⟨j,i⟩ cases j with | none => exact (hs i).1 | some j => exact (hs i).2 · apply affineParameterScale_lower hD hQ hDlog simpa only [Real.exp_add, mul_assoc] using hparam
end Erdos3
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980import OAI.Combinatorics.Progressions.Lattices.AffineSampleAlphabet
namespace OAI
section
namespace Erdos3
open scoped Classical
variable {ι J I Ω : Type*} [Fintype ι] [DecidableEq ι] [Fintype J] [Fintype I] [Fintype Ω] (q : ι → ℕ) [∀ i, NeZero (q i)] (p : FiniteProbabilityWeights Ω) (F : Ω → Option J × I → ℤ) (w : Ω → ℝ)
noncomputable def affinePrimeObservedDensity : (∀ i, (J → I → ZMod (q i)) × (I → ZMod (q i))) → ℝ := observedProductDensity (fun i => residueAffineSource (J := J) (G := I → ZMod (q i))) p (fun z => affinePrimeCoordinateObservation q (F z)) w
theorem affinePrimeObservedDensity_pullback (x : ∀ i, Option J × I → ZMod (q i)) : affinePrimeObservedDensity q p F w (fun i => affineSampleAlphabetEquiv (x i)) = observedProductDensity (primeCoordinateReference (σ := Option J × I) q) p (fun z => primeCoordinateObservation q (F z)) w x := observedProductDensity_coordinate_equiv _ _ (fun _ => affineSampleAlphabetEquiv) (fun _ => affineSampleAlphabet_weight) p (fun z => primeCoordinateObservation q (F z)) w x
theorem affinePrimeObservedDensity_energy (D : Finset (Finset ι)) : productANOVAEnergy (primeCoordinateReference (σ := Option J × I) q) D (observedProductDensity (primeCoordinateReference (σ := Option J × I) q) p (fun z => primeCoordinateObservation q (F z)) w) = productANOVAEnergy (fun i => residueAffineSource (J := J) (G := I → ZMod (q i))) D (affinePrimeObservedDensity q p F w) := observedProductDensity_coordinate_energy _ _ (fun _ => affineSampleAlphabetEquiv) (fun _ => affineSampleAlphabet_weight) p (fun z => primeCoordinateObservation q (F z)) w D
theorem affinePrimeObservedDensity_marginals_iff (η : ℝ) (r : ℕ) : ProductMarginalsClose (fun i => residueAffineSource (J := J) (G := I → ZMod (q i))) (affinePrimeObservedDensity q p F w) η r ↔ ProductMarginalsClose (primeCoordinateReference (σ := Option J × I) q) (observedProductDensity (primeCoordinateReference (σ := Option J × I) q) p (fun z => primeCoordinateObservation q (F z)) w) η r := by rw [productMarginalsClose_coordinate_equiv_iff (primeCoordinateReference (σ := Option J × I) q) (fun i => residueAffineSource (J := J) (G := I → ZMod (q i))) (fun _ => affineSampleAlphabetEquiv) (fun _ => affineSampleAlphabet_weight)] simp only [affinePrimeObservedDensity_pullback]
theorem affinePrimeObservedDensity_section (T A : Finset ι) (z x : ∀ i, Option J × I → ZMod (q i)) : productSectionAverage (primeCoordinateReference (σ := Option J × I) q) T A z (observedProductDensity (primeCoordinateReference (σ := Option J × I) q) p (fun v => primeCoordinateObservation q (F v)) w) x = productSectionAverage (fun i => residueAffineSource (J := J) (G := I → ZMod (q i))) T A (fun i => affineSampleAlphabetEquiv (z i)) (affinePrimeObservedDensity q p F w) (fun i => affineSampleAlphabetEquiv (x i)) := by have he := funext (affinePrimeObservedDensity_pullback q p F w) rw [← he] exact productSectionAverage_coordinate_transport _ _ (fun _ => affineSampleAlphabetEquiv) (fun _ => affineSampleAlphabet_mean) T A z _ x
theorem affinePrimeObservedDensity_section_energy (T A : Finset ι) (z : ∀ i, Option J × I → ZMod (q i)) (D : Finset (Finset ι)) : productANOVAEnergy (primeCoordinateReference (σ := Option J × I) q) D (productSectionAverage (primeCoordinateReference (σ := Option J × I) q) T A z (observedProductDensity (primeCoordinateReference (σ := Option J × I) q) p (fun v => primeCoordinateObservation q (F v)) w)) = productANOVAEnergy (fun i => residueAffineSource (J := J) (G := I → ZMod (q i))) D (productSectionAverage (fun i => residueAffineSource (J := J) (G := I → ZMod (q i))) T A (fun i => affineSampleAlphabetEquiv (z i)) (affinePrimeObservedDensity q p F w)) := by rw [show productSectionAverage (primeCoordinateReference (σ := Option J × I) q) T A z (observedProductDensity (primeCoordinateReference (σ := Option J × I) q) p (fun v => primeCoordinateObservation q (F v)) w) = _ from funext (affinePrimeObservedDensity_section q p F w T A z)] exact productANOVAEnergy_coordinate_transport _ _ (fun _ => affineSampleAlphabetEquiv) (fun _ => affineSampleAlphabet_mean) D _
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521import OAI.Combinatorics.Progressions.Estimates.OneSiteWeightIdentityimport OAI.Combinatorics.Progressions.Fourier.CoefficientFourierTranslationimport OAI.Combinatorics.Progressions.Linear.ProductOneSiteProjectionCap
namespace OAI
section
namespace Erdos3
theorem selectedResidueDensityPMF_test_le {K I : Type*} [Fintype K] [Fintype I] (modulus : I → ℕ) (G : Finset (ColumnResiduePattern K I modulus)) (V : K × I → ℝ) (hV : ∀ z, 0 < V z) (hZ : 0 < ∑' x, selectedResidueSmoothWeight modulus G V x) (D g φ : (K × I → ℤ) → ℝ) (hD0 : ∀ x, 0 ≤ D x) (hD : 0 < selectedResidueDensityMass modulus G V D) {C ε a : ℝ} (ha : 0 < a) (hlower : a ≤ selectedResidueDensityMass modulus G V D) (hg : ∀ x, g x ≤ C) (hφ : ∀ x, 0 ≤ φ x) (he : |(∑' x, (selectedResidueSmoothPMF modulus G V hV hZ x).toReal * (D x * φ x)) - ∑' x, (selectedResidueSmoothPMF modulus G V hV hZ x).toReal * (g x * φ x)| ≤ ε) : (∑' x, (selectedResidueDensityPMF modulus G V hV hZ D hD0 hD x).toReal * φ x) ≤ (C * (∑' x, (selectedResidueSmoothPMF modulus G V hV hZ x).toReal * φ x) + ε) / a := by let prob := selectedResidueFiniteLaw modulus G V hV hZ have hmean (f : (K × I → ℤ) → ℝ) : prob.mean (fun x => f x.val) = ∑' x, (selectedResidueSmoothPMF modulus G V hV hZ x).toReal * f x := selectedResidueFiniteLaw_mean modulus G V hV hZ f have hm : prob.mean (fun x => D x.val) = selectedResidueDensityMass modulus G V D := selectedResidueFiniteLaw_densityMass modulus G V hV hZ D have hb := prob.mean_mul_le_of_capped_comparison (ε := ε) (fun x => D x.val) (fun x => g x.val) (fun x => φ x.val) (fun x => hφ x.val) (fun x => hg x.val) (by rw [hmean (fun x => D x * φ x), hmean (fun x => g x * φ x)] exact he) have hn := prob.reweightPositive_test_le (fun x => D x.val) (fun x => hD0 x.val) (hm.symm ▸ hD) (fun x => φ x.val) (fun x => hφ x.val) ha (hm.symm ▸ hlower) hb rw [FiniteProbabilityWeights.reweightPositive_mean, hm, hmean (fun x => D x * φ x), hmean φ] at hn rw [selectedResidueDensityPMF_mean] exact hn
theorem selectedResidueDensityPMF_test_le_of_complex {K I : Type*} [Fintype K] [Fintype I] (modulus : I → ℕ) (G : Finset (ColumnResiduePattern K I modulus)) (V : K × I → ℝ) (hV : ∀ z, 0 < V z) (hZ : 0 < ∑' x, selectedResidueSmoothWeight modulus G V x) (D g φ : (K × I → ℤ) → ℝ) (hD0 : ∀ x, 0 ≤ D x) (hD : 0 < selectedResidueDensityMass modulus G V D) {C ε a : ℝ} (ha : 0 < a) (hlower : a ≤ selectedResidueDensityMass modulus G V D) (hg : ∀ x, g x ≤ C) (hφ : ∀ x, 0 ≤ φ x) (he : ‖(∑' x, ((selectedResidueSmoothPMF modulus G V hV hZ x).toReal : ℂ) * ((φ x : ℂ) * (D x : ℂ))) - ∑' x, ((selectedResidueSmoothPMF modulus G V hV hZ x).toReal : ℂ) * ((φ x : ℂ) * (g x : ℂ))‖ ≤ ε) : (∑' x, (selectedResidueDensityPMF modulus G V hV hZ D hD0 hD x).toReal * φ x) ≤ (C * (∑' x, (selectedResidueSmoothPMF modulus G V hV hZ x).toReal * φ x) + ε) / a := by apply selectedResidueDensityPMF_test_le modulus G V hV hZ D g φ hD0 hD ha hlower hg hφ simp only [← Complex.ofReal_mul, ← Complex.ofReal_tsum, ← Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs] at he simpa only [mul_comm, mul_left_comm, mul_assoc] using he
end Erdos3
end
section
namespace Erdos3
theorem selectedResidueSmoothPMF_test_le_of_complex {K I : Type*} [Fintype K] [Fintype I] (modulus : I → ℕ) (G : Finset (ColumnResiduePattern K I modulus)) (V : K × I → ℝ) (hV : ∀ z, 0 < V z) (hZ : 0 < ∑' x, selectedResidueSmoothWeight modulus G V x) (D g φ : (K × I → ℤ) → ℝ) {C ε : ℝ} (hg : ∀ x, g x ≤ C) (hφ : ∀ x, 0 ≤ φ x) (he : ‖(∑' x, ((selectedResidueSmoothPMF modulus G V hV hZ x).toReal : ℂ) * ((φ x : ℂ) * (D x : ℂ))) - ∑' x, ((selectedResidueSmoothPMF modulus G V hV hZ x).toReal : ℂ) * ((φ x : ℂ) * (g x : ℂ))‖ ≤ ε) : (∑' x, (selectedResidueSmoothPMF modulus G V hV hZ x).toReal * (φ x * D x)) ≤ C * (∑' x, (selectedResidueSmoothPMF modulus G V hV hZ x).toReal * φ x) + ε := by let prob := selectedResidueFiniteLaw modulus G V hV hZ have hmean (f : (K × I → ℤ) → ℝ) : prob.mean (fun x => f x.val) = ∑' x, (selectedResidueSmoothPMF modulus G V hV hZ x).toReal * f x := selectedResidueFiniteLaw_mean modulus G V hV hZ f simp only [← Complex.ofReal_mul, ← Complex.ofReal_tsum, ← Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs] at he have h := prob.mean_mul_le_of_capped_comparison (ε := ε) (fun x => D x.val) (fun x => g x.val) (fun x => φ x.val) (fun x => hφ x.val) (fun x => hg x.val) (by rw [hmean (fun x => D x * φ x), hmean (fun x => g x * φ x)] simpa only [mul_comm, mul_left_comm, mul_assoc] using he) rw [hmean (fun x => D x * φ x), hmean φ] at h simpa only [mul_comm, mul_left_comm, mul_assoc] using h
end Erdos3
end
section
namespace Erdos3.BooleanCubeKernel
open VectorPolynomial
noncomputable def physicalAffineSite {I K : Type*} [Fintype K] (root : K → ℤ) (z : Option K × I → ℤ) : I → ℝ := integerSiteValue (fun k => match k with | none => 1 | some k => root k) (fun k j => (z (k,j) : ℝ))
theorem integerSiteValue_oneSite {I K : Type*} [Fintype K] (root : K → ℤ) (difference : Fin 0 → K → ℤ) (z : Option K × I → ℤ) : integerSiteValue (affineSite root difference ∅) (fun k j => (z (k,j) : ℝ)) = physicalAffineSite root z := by have hs : affineSite root difference ∅ = (fun k => match k with | none => 1 | some k => root k) := by funext k cases k <;> simp [affineSite] rw [hs] rfl
theorem layeredSiteWeight_physical {I K : Type*} [Fintype K] (root : K → ℤ) (difference : Fin 0 → K → ℤ) (φ : (I → ℝ) → ℂ) (z : Option K × I → ℤ) : layeredSiteWeight 0 (fun s => affineSite root difference s) (fun _ => φ) (fun k j => (z (k,j) : ℝ)) = φ (physicalAffineSite root z) := by rw [layeredSiteWeight_oneSite, integerSiteValue_oneSite]
end Erdos3.BooleanCubeKernel
end
section
namespace Erdos3.BooleanCubeKernel
open MeasureTheory VectorPolynomial
theorem selectedResidue_oneSite_density_error {I K F : Type*} [Fintype I] [Fintype K] [Fintype F] {m : ℕ} {J : Fin m → Type*} [∀ j, Fintype (J j)] (U : ∀ j, Submodule ℝ (J j → ℝ)) (t : K → ℤ) (difference : Fin 0 → K → ℤ) [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (c : F → ℂ) (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] (D : CoefficientTorus (K := K) U → ℝ) {η ε : ℝ} (hη : 0 ≤ η) (happrox : ∀ x, ‖coefficientTorusFourierSum U frequency c x - (D x : ℂ)‖ ≤ η) (hD : ∀ y, Integrable (fun x => D (coefficientFiberMap U t y x)) μ) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (hm : ∀ j d, coefficients (p j) d ∈ U j) (stride : I → ℕ) (G : Finset (ColumnResiduePattern (Option K) I stride)) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (hZ : 0 < ∑' x, selectedResidueSmoothWeight stride G V x) (w : (Option K × I → ℤ) → ℂ) (hw : ∀ x, ‖w x‖ ≤ 1) (hprojection : ‖(∑' x, ((selectedResidueSmoothPMF stride G V hV hZ x).toReal : ℂ) * (w x * affineCubeFourierSum frequency p c (fun k j => (x (k, j) : ℝ)))) - ∑' x, ((selectedResidueSmoothPMF stride G V hV hZ x).toReal : ℂ) * (w x * affineCubeFourierProjection U t difference frequency p c (fun k j => (x (k, j) : ℝ)))‖ ≤ ε) : ‖(∑' x, ((selectedResidueSmoothPMF stride G V hV hZ x).toReal : ℂ) * (w x * (D (affineSampleCoefficientTorus U p hm (fun k j => (x (k, j) : ℝ))) : ℂ))) - ∑' x, ((selectedResidueSmoothPMF stride G V hV hZ x).toReal : ℂ) * (w x * ((coefficientFiberAverage U μ t D (coefficientEvaluationTorus U t (affineSampleCoefficientTorus U p hm (fun k j => (x (k, j) : ℝ)))) : ℝ) : ℂ))‖ ≤ 2 * η + ε := by let prob := selectedResidueFiniteLaw stride G V hV hZ have hmean (f : (Option K × I → ℤ) → ℂ) : prob.complexMean (fun x => f x.val) = ∑' x, ((selectedResidueSmoothPMF stride G V hV hZ x).toReal : ℂ) * f x := selectedResidueFiniteLaw_complexMean stride G V hV hZ f have hw' : prob.mean (fun x => ‖w x.val‖) ≤ 1 := (prob.mean_mono (fun x => hw x.val)).trans_eq (prob.mean_const 1) have he := oneSiteDensity_projection_error (ε := ε) U t difference frequency c μ D hη happrox p hp hm prob (fun x k j => (x.val (k, j) : ℝ)) (fun x => w x.val) (fun _ _ => hD _) hw' (by rw [hmean (fun x => w x * affineCubeFourierSum frequency p c (fun k j => (x (k, j) : ℝ))), hmean (fun x => w x * affineCubeFourierProjection U t difference frequency p c (fun k j => (x (k, j) : ℝ)))] exact hprojection) rw [hmean (fun x => w x * (D (affineSampleCoefficientTorus U p hm (fun k j => (x (k, j) : ℝ))) : ℂ)), hmean (fun x => w x * ((coefficientFiberAverage U μ t D (coefficientEvaluationTorus U t (affineSampleCoefficientTorus U p hm (fun k j => (x (k, j) : ℝ)))) : ℝ) : ℂ))] at he simpa only [mul_one] using he
end Erdos3.BooleanCubeKernel
end
section
namespace Erdos3.BooleanCubeKernel
open MeasureTheory VectorPolynomialopen scoped BigOperators
theorem exists_affine_oneSite_density_comparison (m : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {J : Fin m → Type*} [∀ j, Fintype (J j)] {F : Type*} [Fintype F] {P : ℝ} (_hP : 0 ≤ P) (_hn : (Fintype.card I : ℝ) ≤ P) (_hd : (Fintype.card (Option K × I) : ℝ) ≤ P) (U : ∀ j, Submodule ℝ (J j → ℝ)) [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] (root : K → ℤ) (difference : Fin 0 → K → ℤ) {L C : ℝ} (_hL : 0 ≤ L) (_hC : 0 ≤ C) (_hLP : L ≤ Real.exp P) (_hCP : C ≤ Real.exp P) (_hsite : ∀ (s : Finset (Fin 0)) k, |((affineSite root difference s (some k) : ℤ) : ℝ)| ≤ L) (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (_hbound : ∀ a j d, d.degree ≤ j.val + 1 → ∀ t, |(frequency a j d t : ℝ)| ≤ C) (c : F → ℂ) {B : ℝ} (_hB : 0 ≤ B) (_hBP : B ≤ Real.exp P) (_hcoefficients : (∑ a, ‖c a‖) ≤ B) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (_hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (_hm : ∀ j d, coefficients (p j) d ∈ U j) (stride : I → ℕ) (_hs : ∀ k, 0 < stride k) {R S ρ ε : ℝ} (_hS : 0 ≤ S) (_hSP : S ≤ Real.exp P) (_hρ : 0 < ρ) (_hε : 0 < ε) (_hρP : 1 / ρ ≤ Real.exp P) (_hεP : 1 / ε ≤ Real.exp P) (_hstride : ∀ k, (stride k : ℝ) ≤ S) (H : I → ℝ) (_hsize : ∀ k, Real.exp ((P + A) ^ A) ≤ H k) (_hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (_hR : Real.exp ((P + A) ^ A) ≤ R) (Q : MvPolynomial (Option K × I) ℝ) (_hQ : Q.totalDegree ≤ 0) (test : Finset (Fin 0) → (I → ℝ) → ℂ) (_htest : ∀ t v, ‖test t v‖ ≤ 1) (G : Finset (ColumnResiduePattern (Option K) I stride)) (_hG : G.Nonempty) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (_hwidth : ∀ z, ρ * H z.2 ≤ V z) (D : CoefficientTorus (K := K) U → ℝ) (_hD : ∀ y, Integrable (fun x => D (coefficientFiberMap U root y x)) μ) {η : ℝ} (_hη : 0 ≤ η) (_happrox : ∀ x, ‖coefficientTorusFourierSum U frequency c x - (D x : ℂ)‖ ≤ η), ∃ hZ : 0 < ∑' x, selectedResidueSmoothWeight stride G V x, ‖(∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * (layeredSiteWeight Q (fun s => affineSite root difference s) test (fun k j => (z (k, j) : ℝ)) * (D (affineSampleCoefficientTorus U p _hm (fun k j => (z (k, j) : ℝ))) : ℂ))) - (∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * (layeredSiteWeight Q (fun s => affineSite root difference s) test (fun k j => (z (k, j) : ℝ)) * ((coefficientFiberAverage U μ root D (coefficientEvaluationTorus U root (affineSampleCoefficientTorus U p _hm (fun k j => (z (k, j) : ℝ)))) : ℝ) : ℂ)))‖ ≤ 2 * η + ε := by obtain ⟨A, hA, hprojection⟩ := exists_affine_cube_fourier_projection m 0 refine ⟨A, hA, ?_⟩ intro I K _ _ _ J _ F _ P hP hn hd U _ _ μ _ _ root difference L C hL hC hLP hCP hsite frequency hbound c B hB hBP hcoefficients p hp hm stride hs R S ρ ε hS hSP hρ hε hρP hεP hstride H hsize hrank hR Q hQ test htest G hG V hV hwidth D hD η hη happrox obtain ⟨hZ, he⟩ := hprojection hP hn hd U root difference linearIndependent_empty_type hL hC hLP hCP hsite frequency hbound c hB hBP hcoefficients p hp hm stride hs hS hSP hρ hε hρP hεP hstride H hsize hrank hR Q hQ test htest G hG V hV hwidth refine ⟨hZ, ?_⟩ exact selectedResidue_oneSite_density_error U root difference frequency c μ D hη happrox hD p hp hm stride G V hV hZ (fun z => layeredSiteWeight Q (fun s => affineSite root difference s) test (fun k j => (z (k, j) : ℝ))) (fun z => layeredSiteWeight_norm_le Q _ test htest _) he
end Erdos3.BooleanCubeKernel
end
section
namespace Erdos3.BooleanCubeKernel
open MeasureTheory VectorPolynomialopen scoped BigOperators
theorem exists_affine_oneSite_test_domination (m : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {J : Fin m → Type*} [∀ j, Fintype (J j)] {F : Type*} [Fintype F] {P : ℝ} (_hP : 0 ≤ P) (_hn : (Fintype.card I : ℝ) ≤ P) (_hd : (Fintype.card (Option K × I) : ℝ) ≤ P) (U : ∀ j, Submodule ℝ (J j → ℝ)) [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] (root : K → ℤ) (difference : Fin 0 → K → ℤ) {L C : ℝ} (_hL : 0 ≤ L) (_hC : 0 ≤ C) (_hLP : L ≤ Real.exp P) (_hCP : C ≤ Real.exp P) (_hsite : ∀ (s : Finset (Fin 0)) k, |((affineSite root difference s (some k) : ℤ) : ℝ)| ≤ L) (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (_hbound : ∀ a j d, d.degree ≤ j.val + 1 → ∀ t, |(frequency a j d t : ℝ)| ≤ C) (c : F → ℂ) {B : ℝ} (_hB : 0 ≤ B) (_hBP : B ≤ Real.exp P) (_hcoefficients : (∑ a, ‖c a‖) ≤ B) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (_hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (_hm : ∀ j d, coefficients (p j) d ∈ U j) (stride : I → ℕ) (_hs : ∀ k, 0 < stride k) {R S ρ ε : ℝ} (_hS : 0 ≤ S) (_hSP : S ≤ Real.exp P) (_hρ : 0 < ρ) (_hε : 0 < ε) (_hρP : 1 / ρ ≤ Real.exp P) (_hεP : 1 / ε ≤ Real.exp P) (_hstride : ∀ k, (stride k : ℝ) ≤ S) (H : I → ℝ) (_hsize : ∀ k, Real.exp ((P + A) ^ A) ≤ H k) (_hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (_hR : Real.exp ((P + A) ^ A) ≤ R) (G : Finset (ColumnResiduePattern (Option K) I stride)) (_hG : G.Nonempty) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (_hwidth : ∀ z, ρ * H z.2 ≤ V z) (D : CoefficientTorus (K := K) U → ℝ) (_hD : ∀ y, Integrable (fun x => D (coefficientFiberMap U root y x)) μ) {η : ℝ} (_hη : 0 ≤ η) (_happrox : ∀ x, ‖coefficientTorusFourierSum U frequency c x - (D x : ℂ)‖ ≤ η) (_hD0 : ∀ x, 0 ≤ D x) {M a : ℝ} (_ha : 0 < a) (_hlower : a ≤ selectedResidueDensityMass stride G V (fun z => D (affineSampleCoefficientTorus U p _hm (fun k j => (z (k, j) : ℝ))))) (_hcap : ∀ y, coefficientFiberAverage U μ root D y ≤ M) (φ : (I → ℝ) → ℝ) (_hφ : ∀ v, φ v ∈ Set.Icc (0 : ℝ) 1), ∃ hZ : 0 < ∑' x, selectedResidueSmoothWeight stride G V x, ∃ hDpos : 0 < selectedResidueDensityMass stride G V (fun z => D (affineSampleCoefficientTorus U p _hm (fun k j => (z (k, j) : ℝ)))), (∑' z, (selectedResidueDensityPMF stride G V hV hZ (fun z => D (affineSampleCoefficientTorus U p _hm (fun k j => (z (k, j) : ℝ)))) (fun _ => _hD0 _) hDpos z).toReal * φ (integerSiteValue (affineSite root difference ∅) (fun k j => (z (k, j) : ℝ)))) ≤ (M * (∑' z, (selectedResidueSmoothPMF stride G V hV hZ z).toReal * φ (integerSiteValue (affineSite root difference ∅) (fun k j => (z (k, j) : ℝ)))) + (2 * η + ε)) / a := by obtain ⟨A, hA, hcomparison⟩ := exists_affine_oneSite_density_comparison m refine ⟨A, hA, ?_⟩ intro I K _ _ _ J _ F _ P hP hn hd U _ _ μ _ _ root difference L C hL hC hLP hCP hsite frequency hbound c B hB hBP hcoefficients p hp hm stride hs R S ρ ε hS hSP hρ hε hρP hεP hstride H hsize hrank hR G hG V hV hwidth D hD η hη happrox hD0 M a ha hlower hcap φ hφ have hφn (v : I → ℝ) : ‖(φ v : ℂ)‖ ≤ 1 := by rw [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hφ v).1] exact (hφ v).2 obtain ⟨hZ, he⟩ := hcomparison hP hn hd U μ root difference hL hC hLP hCP hsite frequency hbound c hB hBP hcoefficients p hp hm stride hs hS hSP hρ hε hρP hεP hstride H hsize hrank hR 0 (by simp) (fun _ v => (φ v : ℂ)) (fun _ v => hφn v) G hG V hV hwidth D hD hη happrox have hDpos : 0 < selectedResidueDensityMass stride G V (fun z => D (affineSampleCoefficientTorus U p hm (fun k j => (z (k, j) : ℝ)))) := ha.trans_le hlower refine ⟨hZ, hDpos, ?_⟩ simp only [layeredSiteWeight_oneSite] at he exact selectedResidueDensityPMF_test_le_of_complex (C := M) (ε := 2 * η + ε) (a := a) stride G V hV hZ (fun z => D (affineSampleCoefficientTorus U p hm (fun k j => (z (k, j) : ℝ)))) (fun z => coefficientFiberAverage U μ root D (coefficientEvaluationTorus U root (affineSampleCoefficientTorus U p hm (fun k j => (z (k, j) : ℝ))))) (fun z => φ (integerSiteValue (affineSite root difference ∅) (fun k j => (z (k, j) : ℝ)))) (fun _ => hD0 _) hDpos ha hlower (fun _ => hcap _) (fun _ => (hφ _).1) he
end Erdos3.BooleanCubeKernel
end
section
namespace Erdos3.BooleanCubeKernel
open MeasureTheory VectorPolynomialopen scoped BigOperators
theorem exists_affine_translated_oneSite_density_comparison (m : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {J : Fin m → Type*} [∀ j, Fintype (J j)] {F : Type*} [Fintype F] {P : ℝ} (_hP : 0 ≤ P) (_hn : (Fintype.card I : ℝ) ≤ P) (_hd : (Fintype.card (Option K × I) : ℝ) ≤ P) (U : ∀ j, Submodule ℝ (J j → ℝ)) [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] (root : K → ℤ) {L C : ℝ} (_hL : 0 ≤ L) (_hC : 0 ≤ C) (_hLP : L ≤ Real.exp P) (_hCP : C ≤ Real.exp P) (_hsite : ∀ k, |(root k : ℝ)| ≤ L) (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (_hbound : ∀ a j d, d.degree ≤ j.val + 1 → ∀ t, |(frequency a j d t : ℝ)| ≤ C) (c : F → ℂ) {B : ℝ} (_hB : 0 ≤ B) (_hBP : B ≤ Real.exp P) (_hcoefficients : (∑ a, ‖c a‖) ≤ B) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (_hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (_hm : ∀ j d, coefficients (p j) d ∈ U j) (stride : I → ℕ) (_hs : ∀ k, 0 < stride k) {R S ρ ε : ℝ} (_hS : 0 ≤ S) (_hSP : S ≤ Real.exp P) (_hρ : 0 < ρ) (_hε : 0 < ε) (_hρP : 1 / ρ ≤ Real.exp P) (_hεP : 1 / ε ≤ Real.exp P) (_hstride : ∀ k, (stride k : ℝ) ≤ S) (H : I → ℝ) (_hsize : ∀ k, Real.exp ((P + A) ^ A) ≤ H k) (_hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (_hR : Real.exp ((P + A) ^ A) ≤ R) (G : Finset (ColumnResiduePattern (Option K) I stride)) (_hG : G.Nonempty) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (_hwidth : ∀ z, ρ * H z.2 ≤ V z) (D : CoefficientTorus (K := K) U → ℝ) (_hD : Measurable D) {M : ℝ} (_hDbound : ∀ x, ‖D x‖ ≤ M) {η : ℝ} (_hη : 0 ≤ η) (_happrox : ∀ x, ‖(D x : ℂ) - coefficientTorusFourierSum U frequency c x‖ ≤ η) (center : CoefficientTorus (K := K) U) (φphysical : (I → ℝ) → ℂ) (_hφ : ∀ v, ‖φphysical v‖ ≤ 1), ∃ hZ : 0 < ∑' x, selectedResidueSmoothWeight stride G V x, ‖(∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * (φphysical (physicalAffineSite root z) * (D (center + affineSampleCoefficientTorus U p _hm (fun k j => (z (k, j) : ℝ))) : ℂ))) - (∑' z : Option K × I → ℤ, ((selectedResidueSmoothPMF stride G V hV hZ z).toReal : ℂ) * (φphysical (physicalAffineSite root z) * (((coefficientFiberAverage U μ root (fun x => D (center + x)) (coefficientEvaluationTorus U root (affineSampleCoefficientTorus U p _hm (fun k j => (z (k, j) : ℝ))))) : ℝ) : ℂ)))‖ ≤ 2 * η + ε := by obtain ⟨A, hA, hcomparison⟩ := exists_affine_oneSite_density_comparison m refine ⟨A, hA, ?_⟩ intro I K _ _ _ J _ F _ P hP hn hd U _ _ μ _ _ root L C hL hC hLP hCP hsite frequency hbound c B hB hBP hcoefficients p hp hm stride hs R S ρ ε hS hSP hρ hε hρP hεP hstride H hsize hrank hR G hG V hV hwidth D hD M hDbound η hη happrox center φphysical hφ let difference : Fin 0 → K → ℤ := fun i => Fin.elim0 i have hsite' (s : Finset (Fin 0)) (k : K) : |((affineSite root difference s (some k) : ℤ) : ℝ)| ≤ L := by have hs : s = ∅ := Subsingleton.elim _ _ simpa [hs, affineSite] using hsite k have hcoefficients' : (∑ a, ‖c a * coefficientTorusCharacter U (frequency a) center‖) ≤ B := by rw [coefficientFourier_translate_norm] exact hcoefficients have happrox' (x) : ‖coefficientTorusFourierSum U frequency (fun a => c a * coefficientTorusCharacter U (frequency a) center) x - (D (center + x) : ℂ)‖ ≤ η := by rw [norm_sub_rev] exact coefficientFourier_translate_approx U D frequency c happrox center x have hintegrable (y) : Integrable (fun x => D (center + coefficientFiberMap U root y x)) μ := bounded_coefficient_translate_fiber_integrable U μ D hD hDbound center root y obtain ⟨hZ, he⟩ := hcomparison hP hn hd U μ root difference hL hC hLP hCP hsite' frequency hbound (fun a => c a * coefficientTorusCharacter U (frequency a) center) hB hBP hcoefficients' p hp hm stride hs hS hSP hρ hε hρP hεP hstride H hsize hrank hR 0 (by simp) (fun _ => φphysical) (fun _ => hφ) G hG V hV hwidth (fun x => D (center + x)) hintegrable hη happrox' refine ⟨hZ, ?_⟩ simpa only [layeredSiteWeight_physical] using he
end Erdos3.BooleanCubeKernel
end
section
namespace Erdos3.BooleanCubeKernel
open MeasureTheory VectorPolynomialopen scoped BigOperators
theorem exists_affine_oneSite_normalized_domination (m : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {J : Fin m → Type*} [∀ j, Fintype (J j)] {F : Type*} [Fintype F] {P : ℝ} (_hP : 0 ≤ P) (_hn : (Fintype.card I : ℝ) ≤ P) (_hd : (Fintype.card (Option K × I) : ℝ) ≤ P) (U : ∀ j, Submodule ℝ (J j → ℝ)) [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] (root : K → ℤ) (difference : Fin 0 → K → ℤ) {L C : ℝ} (_hL : 0 ≤ L) (_hC : 0 ≤ C) (_hLP : L ≤ Real.exp P) (_hCP : C ≤ Real.exp P) (_hsite : ∀ (s : Finset (Fin 0)) k, |((affineSite root difference s (some k) : ℤ) : ℝ)| ≤ L) (frequency : F → ∀ j, (K →₀ ℕ) → J j → ℤ) (_hbound : ∀ a j d, d.degree ≤ j.val + 1 → ∀ t, |(frequency a j d t : ℝ)| ≤ C) (c : F → ℂ) {B : ℝ} (_hB : 0 ≤ B) (_hBP : B ≤ Real.exp P) (_hcoefficients : (∑ a, ‖c a‖) ≤ B) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (_hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (_hm : ∀ j d, coefficients (p j) d ∈ U j) (stride : I → ℕ) (_hs : ∀ k, 0 < stride k) {R S ρ ε : ℝ} (_hS : 0 ≤ S) (_hSP : S ≤ Real.exp P) (_hρ : 0 < ρ) (_hε : 0 < ε) (_hρP : 1 / ρ ≤ Real.exp P) (_hεP : 1 / ε ≤ Real.exp P) (_hstride : ∀ k, (stride k : ℝ) ≤ S) (H : I → ℝ) (_hsize : ∀ k, Real.exp ((P + A) ^ A) ≤ H k) (_hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (_hR : Real.exp ((P + A) ^ A) ≤ R) (G : Finset (ColumnResiduePattern (Option K) I stride)) (_hG : G.Nonempty) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (_hwidth : ∀ z, ρ * H z.2 ≤ V z) (D : CoefficientTorus (K := K) U → ℝ) (_hDglobal : Integrable D μ) (_hDmass : (∫ x, D x ∂μ) = 1) (_hD : ∀ y, Integrable (fun x => D (coefficientFiberMap U root y x)) μ) {η : ℝ} (_hη : 0 ≤ η) (_happrox : ∀ x, ‖coefficientTorusFourierSum U frequency c x - (D x : ℂ)‖ ≤ η) (_hsmall : 2 * η + ε ≤ 1 / 2) (_hD0 : ∀ x, 0 ≤ D x) {M : ℝ} (_hcap : ∀ y, coefficientFiberAverage U μ root D y ≤ M) (φ : (I → ℝ) → ℝ) (_hφ : ∀ v, φ v ∈ Set.Icc (0 : ℝ) 1), ∃ hZ : 0 < ∑' x, selectedResidueSmoothWeight stride G V x, ∃ hDpos : 0 < selectedResidueDensityMass stride G V (fun z => D (affineSampleCoefficientTorus U p _hm (fun k j => (z (k, j) : ℝ)))), |selectedResidueDensityMass stride G V (fun z => D (affineSampleCoefficientTorus U p _hm (fun k j => (z (k, j) : ℝ)))) - 1| ≤ 2 * η + ε ∧ 1 / 2 ≤ selectedResidueDensityMass stride G V (fun z => D (affineSampleCoefficientTorus U p _hm (fun k j => (z (k, j) : ℝ)))) ∧ (∑' z, (selectedResidueDensityPMF stride G V hV hZ (fun z => D (affineSampleCoefficientTorus U p _hm (fun k j => (z (k, j) : ℝ)))) (fun _ => _hD0 _) hDpos z).toReal * φ (integerSiteValue (affineSite root difference ∅) (fun k j => (z (k, j) : ℝ)))) ≤ (M * (∑' z, (selectedResidueSmoothPMF stride G V hV hZ z).toReal * φ (integerSiteValue (affineSite root difference ∅) (fun k j => (z (k, j) : ℝ)))) + (2 * η + ε)) / (1 / 2 : ℝ) := by obtain ⟨A₀, hA₀, hmass⟩ := exists_affine_coefficient_density_mass m obtain ⟨A₁, _hA₁, hdom⟩ := exists_affine_oneSite_test_domination m let A := max A₀ A₁ have hA : 2 ≤ A := hA₀.trans (le_max_left _ _) refine ⟨A, hA, ?_⟩ intro I K _ _ _ J _ F _ P hP hn hd U _ _ μ _ _ root difference L C hL hC hLP hCP hsite frequency hbound c B hB hBP hcoefficients p hp hm stride hs R S ρ ε hS hSP hρ hε hρP hεP hstride H hsize hrank hR G hG V hV hwidth D hDglobal hDmass hD η hη happrox hsmall hD0 M hcap φ hφ have hthreshold (a : ℕ) (ha : a ≤ A) : Real.exp ((P + a) ^ a) ≤ Real.exp ((P + A) ^ A) := by apply Real.exp_le_exp.mpr have haa : (a : ℝ) ≤ A := by exact_mod_cast ha have hbase : P + (a : ℝ) ≤ P + A := by linarith have hAreal : (2 : ℝ) ≤ A := by exact_mod_cast hA exact (pow_le_pow_left₀ (by positivity) hbase a).trans (pow_le_pow_right₀ (by linarith : (1 : ℝ) ≤ P + A) ha) have h₀ := hthreshold A₀ (le_max_left _ _) have h₁ := hthreshold A₁ (le_max_right _ _) obtain ⟨_hZ₀, he⟩ := hmass hP hn hd U μ hC hCP frequency hbound c hB hBP hcoefficients p hp hm stride hs hS hSP hρ hε hρP hεP hstride H (fun k => h₀.trans (hsize k)) hrank (h₀.trans hR) G hG V hV hwidth D hDglobal hDmass hη (fun x => by rw [norm_sub_rev]; exact happrox x) have hlower : 1 / 2 ≤ selectedResidueDensityMass stride G V (fun z => D (affineSampleCoefficientTorus U p hm (fun k j => (z (k, j) : ℝ)))) := by have hh := (abs_le.mp he).1 linarith obtain ⟨hZ, hDpos, hb⟩ := hdom hP hn hd U μ root difference hL hC hLP hCP hsite frequency hbound c hB hBP hcoefficients p hp hm stride hs hS hSP hρ hε hρP hεP hstride H (fun k => h₁.trans (hsize k)) hrank (h₁.trans hR) G hG V hV hwidth D hD hη happrox hD0 (by norm_num : (0 : ℝ) < 1 / 2) hlower hcap φ hφ exact ⟨hZ, hDpos, he, hlower, hb⟩
end Erdos3.BooleanCubeKernel
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289import OAI.Combinatorics.Progressions.Estimates.AdaptiveRatioNormalizationimport OAI.Combinatorics.Progressions.Estimates.GlobalCutoffAtomComparison
namespace OAI
section
namespace Erdos3
open scoped BigOperators Classical
theorem normalized_adaptive_affine_comparison {ι σ J : Type*} [Fintype J] [Fintype ι] [LinearOrder ι] [Fintype σ] {q : ι → ℕ} [∀ i, NeZero (q i)] (lo a : σ → ℤ) (N : σ → ℕ) (hne : Nonempty (IntegerResidueBox lo (fun k => lo k + N k) (fun _ => (1 : ℤ)) a)) (sourceLo sourceA : Option J × σ → ℤ) (sourceN : Option J × σ → ℕ) (hneSource : Nonempty (IntegerResidueBox sourceLo (fun k => sourceLo k + sourceN k) (fun _ => (1 : ℤ)) sourceA)) (h g : (σ → ℤ) → ℂ) (w : (Option J × σ → ℤ) → ℝ) (hg : ∀ z ∈ translatedIntegerBox lo N, 0 ≤ (g z).re ∧ (g z).re ≤ 1) (hh : ∀ z ∈ translatedIntegerBox lo N, 0 ≤ (h z).re ∧ (h z).re ≤ 1) (hw : ∀ z ∈ translatedIntegerBox sourceLo sourceN, 0 ≤ w z ∧ w z ≤ 1) {ε L T C shell totalShell modLog level dimLog sourceDimLog : ℝ} (hε : 0 < ε) (hL : 0 ≤ L) (hT : 0 ≤ T) (hC : 0 ≤ C) (hshell : 0 < shell) (hlower : Real.exp (-L) ≤ level) (hlevel2 : level ≤ 2) (hmodLog : 0 ≤ modLog) (hdimLog : 0 ≤ dimLog) (hsourceDimLog : 0 ≤ sourceDimLog) (hmoduli : ∀ i, (q i : ℝ) ≤ Real.exp modLog) (hcount : (Fintype.card ι : ℝ) ≤ Real.exp C) (hdim : (Fintype.card σ : ℝ) ≤ Real.exp dimLog) (hsourceDim : (Fintype.card (Option J × σ) : ℝ) ≤ Real.exp sourceDimLog) (prime power : ι → ℕ) (hprime : ∀ i, (prime i).Prime) (hpower : ∀ i, q i = prime i ^ power i) (hinj : Function.Injective prime) (hJ : 2 ≤ Fintype.card J) (D : ℕ) (parameterA : J → ℤ) (tree : CoordinateDecisionTree ι (fun i => σ → ZMod (q i))) (baseX : ∀ i, Option J × σ → ZMod (q i)) (baseY : ∀ i, σ → ZMod (q i)) {d A B : ℕ} (htree : CoordinateDecisionTree.Valid (fun K base => affineSamplerPrimeMask prime (ε / (2 + ε)) (affineComparisonScale ε L T C) 1 1 D ⊆ K ∧ ResiduePrimeCoordinateStable g lo N 1 a q (affineRemovalDepth T + affineComparisonTail ε L T) (affineStabilityTolerance T) K base ∧ PrimeRefinementUpperBound h g lo N 1 a q (affineRemovalDepth T + affineComparisonTail ε L T) level (affineIncrementTolerance L T) (affineStabilityTolerance T) K base) ∅ baseY tree d) (hA : d ≤ A) (hB : A + affineComparisonDegree (Fintype.card (Option J × σ)) (Fintype.card σ) ε L T C shell modLog ≤ B) (hBinitial : A + CyclicCrootSisask.spectralIterations shell ((A : ℝ) * ((Fintype.card (Option J × σ) : ℝ) * modLog + (Fintype.card σ : ℝ) * modLog + 1) + 4) ≤ B) (hside : ∀ k, Real.exp (modLog * A + affineComparisonLengthLog B ε L T C modLog dimLog + 2) ≤ (N k : ℝ)) (hsourceSide : ∀ k, Real.exp (modLog * A + affineComparisonLengthLog B ε L T C modLog sourceDimLog + 2) ≤ (sourceN k : ℝ)) (hallocation : Real.exp ((A : ℝ) * (affineComparisonScale ε L T C + (Fintype.card (Option J × σ) : ℝ) * modLog + (Fintype.card σ : ℝ) * modLog + 1)) * shell ≤ totalShell) : productTruncatedPairing (affinePeriodProductCoupling (σ := σ) q D parameterA) (lowDegreeCoordinateSets ι B) (residuePrimeCoordinateDensity sourceLo sourceN 1 sourceA hneSource q w) (fun z => residuePrimeCoordinateDensity lo N 1 a hne q (fun x => (h x).re) z - (1 + ε) * level * residuePrimeCoordinateDensity lo N 1 a hne q (fun x => (g x).re) z) ≤ (1 + affineComparisonAccuracy B (affineComparisonScale ε L T C) L T) * (1 + affineComparisonAccuracy B (affineComparisonScale ε L T C) L T) * (level * (1 + 2 * ε) * Real.exp (-T) + shell / 16 + Real.sqrt (3 * Real.exp (-T)) * (3 + (1 + ε) * level * 3)) + (1 + (1 + ε) * level) * (totalShell / 16) := by have hpair : Pairwise (fun i k => (q i).Coprime (q k)) := by intro i k hik rw [hpower i, hpower k] exact selectedPrimePowers_pairwise_coprime prime power hprime hinj hik have hAB : A ≤ B := (Nat.le_add_right _ _).trans hB have hsite := unconditioned_affine_cell_bounds lo N a hne q hpair hAB hL hT hC hmodLog hdimLog hmoduli hdim hside have hsource := unconditioned_affine_cell_bounds sourceLo sourceN sourceA hneSource q hpair hAB hL hT hC hmodLog hsourceDimLog hmoduli hsourceDim hsourceSide let c := affinePeriodProductCoupling (σ := σ) q D parameterA let source := residuePrimeCoordinateDensity sourceLo sourceN 1 sourceA hneSource q w let target := fun z => residuePrimeCoordinateDensity lo N 1 a hne q (fun x => (h x).re) z - (1 + ε) * level * residuePrimeCoordinateDensity lo N 1 a hne q (fun x => (g x).re) z let eta := affineComparisonAccuracy B (affineComparisonScale ε L T C) L T let R := level * (1 + 2 * ε) * Real.exp (-T) + shell / 16 + Real.sqrt (3 * Real.exp (-T)) * (3 + (1 + ε) * level * 3) let coeff := 1 + (1 + ε) * level let pairs := CoordinateDecisionTree.leafSourceAssignments (fun i => Option J × σ → ZMod (q i)) tree ∅ baseY let ratioX := fun z : Σ leaf : ProductCylinder (fun i => σ → ZMod (q i)), ∀ i : leaf.1, Option J × σ → ZMod (q i.val) => residuePrimeCoordinateMassRatio sourceLo sourceN 1 sourceA q z.1.1 (productSubtypePoint z.1.1 z.2 baseX) let ratioY := fun z : Σ leaf : ProductCylinder (fun i => σ → ZMod (q i)), ∀ i : leaf.1, Option J × σ → ZMod (q i.val) => residuePrimeCoordinateMassRatio lo N 1 a q z.1.1 (z.1.assignment baseY) have hA' : (∅ : Finset ι).card + d ≤ A := by simpa using hA have hleaf (z) (hz : z ∈ pairs) : z.1 ∈ CoordinateDecisionTree.leafCylinders tree ∅ baseY := (CoordinateDecisionTree.mem_leafSourceAssignments (fun i => Option J × σ → ZMod (q i)) tree ∅ baseY z).mp hz have hsize (z) (hz : z ∈ pairs) : z.1.1.card ≤ A := (htree.leaf_card_le z.1 (hleaf z hz)).trans hA' have hratioX (z) (hz : z ∈ pairs) : |ratioX z - 1| ≤ eta := residuePrimeCoordinateMassRatio_close_of_marginals sourceLo sourceN 1 sourceA hneSource q hsource.1 z.1.1 (hsize z hz) (productSubtypePoint z.1.1 z.2 baseX) have hratioY (z) (hz : z ∈ pairs) : |ratioY z - 1| ≤ eta := residuePrimeCoordinateMassRatio_close_of_marginals lo N 1 a hne q hsite.1 z.1.1 (hsize z hz) (z.1.assignment baseY) have hbound (z) (hz : z ∈ pairs) : productAtomTruncatedPairing c (lowDegreeCoordinateSets ι B) z.1.1 (productSubtypePoint z.1.1 z.2 baseX) (z.1.assignment baseY) source target ≤ adaptiveLeafPairMass c baseX baseY z * (ratioX z * ratioY z) * R + coeff * (shell / 16) := by have hcert := htree.leaf_good z.1 (hleaf z hz) let u := (hsite.2.1 z.1.1 (hsize z hz) (z.1.assignment baseY)).some let uX := (hsource.2.1 z.1.1 (hsize z hz) (productSubtypePoint z.1.1 z.2 baseX)).some have hwX (v : ResiduePrimeCoordinateCell sourceLo sourceN 1 sourceA q z.1.1 (productSubtypePoint z.1.1 z.2 baseX)) : 0 ≤ w (fun k => (v.val k).val) ∧ w (fun k => (v.val k).val) ≤ 1 := by apply hw apply (mem_translatedIntegerBox sourceLo sourceN _).mpr intro k exact Finset.mem_Ico.mp ((Finset.mem_filter.mp (v.val k).property).1) have ha := global_cutoff_initial_atom_comparison (hKcard := hsize z hz) (hB := hB) (hstable := hcert.2.1) (hupper := hcert.2.2) (hM := by decide) (u := u) (hg := hg) (hh := hh) (hL := hL) (hT := hT) (hlower := hlower) (prime := prime) (power := power) (hprime := hprime) (hpower := hpower) (hJ := hJ) (hshell := hshell) (hlevel2 := hlevel2) (hmodLog := hmodLog) (hmoduli := hmoduli) (hε := hε) (hC := hC) (hcount := hcount) (dimLog := dimLog) (hdim := hdim) (hlength := hsite.2.2 z.1.1 (hsize z hz) (z.1.assignment baseY) u) (sourceLo := sourceLo) (sourceA := sourceA) (sourceN := sourceN) (sourceM := 1) (sourceBase := productSubtypePoint z.1.1 z.2 baseX) (sourceCell := uX) (w := w) (hw := hwX) (hsourceM := by decide) (sourceDimLog := sourceDimLog) (hsourceDim := hsourceDim) (hsourceLength := hsource.2.2 z.1.1 (hsize z hz) (productSubtypePoint z.1.1 z.2 baseX) uX) (hinj := hinj) (D := D) (parameterA := parameterA) (hmask := hcert.1) (hBinitial := hBinitial) exact ha have hlevel : 0 ≤ level := (Real.exp_pos (-L)).le.trans hlower have hcoeff : 0 ≤ coeff := by dsimp only [coeff]; positivity have hR : 0 ≤ R := by dsimp only [R]; positivity have hP := (affineComparisonScale_bounds (ε := ε) hL hT hC).1 have hcountP := affineComparisonScale_count (ι := ι) (ε := ε) hL hT hC hcount have hcard := affine_leaf_source_assignments_card_le_exp (J := J) q htree hA' hP hmodLog hcountP hmoduli have herror : (∑ _z ∈ pairs, coeff * (shell / 16)) ≤ coeff * (totalShell / 16) := by have hpay := (mul_le_mul_of_nonneg_right hcard hshell.le).trans hallocation have hscale := mul_le_mul_of_nonneg_left hpay (div_nonneg hcoeff (by norm_num : (0 : ℝ) ≤ 16)) calc _ = ((pairs.card : ℝ) * shell) * (coeff / 16) := by simp only [Finset.sum_const, nsmul_eq_mul]; ring _ ≤ totalShell * (coeff / 16) := by nlinarith only [hscale] _ = _ := by ring exact productTruncatedPairing_leaf_normalized_bound c tree (lowDegreeCoordinateSets ι B) baseX baseY source target ratioX ratioY (fun _ => coeff * (shell / 16)) hR hratioX hratioY hbound herror
end Erdos3
end
section
namespace Erdos3
theorem normalized_affine_error_le {ε T level eta shell totalShell : ℝ} (hε : 0 ≤ ε) (hT : 0 ≤ T) (hlevel : 0 ≤ level) (hlevel2 : level ≤ 2) (heta0 : 0 ≤ eta) (heta1 : eta ≤ 1) (hshell : 0 ≤ shell) (htotal : shell ≤ totalShell) : (1 + eta) * (1 + eta) * (level * (1 + 2 * ε) * Real.exp (-T) + shell / 16 + Real.sqrt (3 * Real.exp (-T)) * (3 + (1 + ε) * level * 3)) + (1 + (1 + ��) * level) * (totalShell / 16) ≤ 100 * (1 + ε) * Real.exp (-T / 2) + (1 + ε) * totalShell := by have he : 0 < Real.exp (-T / 2) := Real.exp_pos _ have he0 : 0 < Real.exp (-T) := Real.exp_pos _ have htotal0 : 0 ≤ totalShell := hshell.trans htotal have hdecay : Real.exp (-T) ≤ Real.exp (-T / 2) := Real.exp_le_exp.mpr (by linarith) have hsquare : (Real.exp (-T / 2)) ^ 2 = Real.exp (-T) := by rw [pow_two, ← Real.exp_add] congr 1 ring have hsqrt : Real.sqrt (3 * Real.exp (-T)) ≤ 2 * Real.exp (-T / 2) := by apply (Real.sqrt_le_left (by positivity : 0 ≤ 2 * Real.exp (-T / 2))).mpr nlinarith only [hsquare, he0] have hfirstCoeff : level * (1 + 2 * ε) ≤ 4 * (1 + ε) := by nlinarith have hfirst := mul_le_mul hfirstCoeff hdecay he0.le (by positivity : 0 ≤ 4 * (1 + ε)) have htailCoeff : 3 + (1 + ε) * level * 3 ≤ 9 * (1 + ε) := by nlinarith have htail := mul_le_mul hsqrt htailCoeff (by positivity : 0 ≤ 3 + (1 + ε) * level * 3) (by positivity : 0 ≤ 2 * Real.exp (-T / 2)) have hmain : level * (1 + 2 * ε) * Real.exp (-T) + shell / 16 + Real.sqrt (3 * Real.exp (-T)) * (3 + (1 + ε) * level * 3) ≤ 22 * (1 + ε) * Real.exp (-T / 2) + shell / 16 := by nlinarith only [hfirst, htail] have hmain0 : 0 ≤ level * (1 + 2 * ε) * Real.exp (-T) + shell / 16 + Real.sqrt (3 * Real.exp (-T)) * (3 + (1 + ε) * level * 3) := by positivity have hfactor : (1 + eta) * (1 + eta) ≤ 4 := by nlinarith have hcoeff : 1 + (1 + ε) * level ≤ 3 * (1 + ε) := by nlinarith have herr := mul_le_mul_of_nonneg_right hcoeff (div_nonneg htotal0 (by norm_num : (0 : ℝ) ≤ 16)) have hrest : shell / 4 + 3 * (1 + ε) * (totalShell / 16) ≤ (1 + ε) * totalShell := by nlinarith only [htotal, htotal0, mul_nonneg hε htotal0] calc _ ≤ 4 * (level * (1 + 2 * ε) * Real.exp (-T) + shell / 16 + Real.sqrt (3 * Real.exp (-T)) * (3 + (1 + ε) * level * 3)) + 3 * (1 + ε) * (totalShell / 16) := add_le_add (mul_le_mul_of_nonneg_right hfactor hmain0) herr _ ≤ 4 * (22 * (1 + ε) * Real.exp (-T / 2) + shell / 16) + 3 * (1 + ε) * (totalShell / 16) := by linarith only [hmain] _ ≤ _ := by nlinarith only [hrest, mul_nonneg (by linarith : 0 ≤ 1 + ε) he.le]
theorem affine_error_envelope_at_precision {ε Q : ℝ} (hε : 0 ≤ ε) : 100 * (1 + ε) * Real.exp (-(2 * (Q + Real.log (400 * (1 + ε)))) / 2) + (1 + ε) * (Real.exp (-Q) / (4 * (1 + ε))) = Real.exp (-Q) / 2 := by have ha : 0 < 1 + ε := by linarith have hc : 0 < 400 * (1 + ε) := by positivity have harg : -(2 * (Q + Real.log (400 * (1 + ε)))) / 2 = -Q - Real.log (400 * (1 + ε)) := by ring rw [harg, Real.exp_sub, Real.exp_log hc] field_simp ring
end Erdos3
end
section
namespace Erdos3
noncomputable def affineStabilityInputBudget (p ε L T C modLog parameterLog : ℝ) : ℝ := max p (max (T + 4) (max modLog (max (affineComparisonPrimeThreshold (ε / (2 + ε)) (affineComparisonScale ε L T C) + 2 + 2 * parameterLog) ((affineRemovalDepth T + affineComparisonTail ε L T : ℕ) : ℝ))))
theorem affineStabilityInputBudget_bounds (p ε L T C modLog parameterLog : ℝ) : p ≤ affineStabilityInputBudget p ε L T C modLog parameterLog ∧ T + 4 ≤ affineStabilityInputBudget p ε L T C modLog parameterLog ∧ modLog ≤ affineStabilityInputBudget p ε L T C modLog parameterLog ∧ affineComparisonPrimeThreshold (ε / (2 + ε)) (affineComparisonScale ε L T C) + 2 + 2 * parameterLog ≤ affineStabilityInputBudget p ε L T C modLog parameterLog ∧ ((affineRemovalDepth T + affineComparisonTail ε L T : ℕ) : ℝ) ≤ affineStabilityInputBudget p ε L T C modLog parameterLog := by unfold affineStabilityInputBudget refine ⟨le_max_left _ _, ?_, ?_, ?_, ?_⟩ · exact (le_max_left _ _).trans (le_max_right _ _) · exact (le_max_left _ _).trans ((le_max_right _ _).trans (le_max_right _ _)) · exact (le_max_left _ _).trans ((le_max_right _ _).trans ((le_max_right _ _).trans (le_max_right _ _))) · exact (le_max_right _ _).trans ((le_max_right _ _).trans ((le_max_right _ _).trans (le_max_right _ _)))
theorem affineStabilityInputBudget_mask {ι : Type*} [Fintype ι] (prime : ι → ℕ) (hprime : ∀ i, (prime i).Prime) (hinj : Function.Injective prime) (p ε modLog : ℝ) {L T C parameterLog : ℝ} {D : ℕ} (hL : 0 ≤ L) (hT : 0 ≤ T) (hC : 0 ≤ C) (hD : 0 < D) (hparameter : (D : ℝ) ≤ Real.exp parameterLog) : ((affineSamplerPrimeMask prime (ε / (2 + ε)) (affineComparisonScale ε L T C) 1 1 D).card : ℝ) ≤ affineStabilityInputBudget p ε L T C modLog parameterLog := by have hP := (affineComparisonScale_bounds (ε := ε) hL hT hC).1 have hm := affineSamplerPrimeMask_card_le (ξ := ε / (2 + ε)) prime hprime hinj hP (sourceM := 1) (siteM := 1) (sourceLog := 0) (siteLog := 0) (by decide) (by decide) hD (by simp) (by simp) hparameter have hm' : ((affineSamplerPrimeMask prime (ε / (2 + ε)) (affineComparisonScale ε L T C) 1 1 D).card : ℝ) ≤ affineComparisonPrimeThreshold (ε / (2 + ε)) (affineComparisonScale ε L T C) + 2 + 2 * parameterLog := by simpa only [mul_zero, add_zero] using hm exact hm'.trans (affineStabilityInputBudget_bounds p ε L T C modLog parameterLog).2.2.2.1
noncomputable def affineReferenceTargetTime (ε Q : ℝ) : ℝ := 2 * (Q + Real.log (400 * (1 + ε)))
noncomputable def affineReferenceTargetShell (ε Q : ℝ) : ℝ := Real.exp (-Q) / (4 * (1 + ε))
theorem affineReferenceTargetTime_nonneg {ε Q : ℝ} (hε : 0 ≤ ε) (hQ : 0 ≤ Q) : 0 ≤ affineReferenceTargetTime ε Q := by have hlog : 0 ≤ Real.log (400 * (1 + ε)) := Real.log_nonneg (by linarith) unfold affineReferenceTargetTime positivity
theorem affineReferenceTargetShell_pos {ε : ℝ} (Q : ℝ) (hε : 0 ≤ ε) : 0 < affineReferenceTargetShell ε Q := by unfold affineReferenceTargetShell positivity
theorem affine_error_envelope_le_precision {ε Q T totalShell : ℝ} (hε : 0 ≤ ε) (hT : affineReferenceTargetTime ε Q ≤ T) (hshell : totalShell ≤ affineReferenceTargetShell ε Q) : 100 * (1 + ε) * Real.exp (-T / 2) + (1 + ε) * totalShell ≤ Real.exp (-Q) / 2 := by have ht : Real.exp (-T / 2) ≤ Real.exp (-affineReferenceTargetTime ε Q / 2) := Real.exp_le_exp.mpr (by linarith) have hfirst := mul_le_mul_of_nonneg_left ht (by positivity : 0 ≤ 100 * (1 + ε)) have hsecond := mul_le_mul_of_nonneg_left hshell (by linarith : 0 ≤ 1 + ε) exact (add_le_add hfirst hsecond).trans_eq (affine_error_envelope_at_precision hε)
theorem affine_error_envelope_lt_target {ε Q T totalShell : ℝ} (hε : 0 ≤ ε) (hT : affineReferenceTargetTime ε Q ≤ T) (hshell : totalShell ≤ affineReferenceTargetShell ε Q) : 100 * (1 + ε) * Real.exp (-T / 2) + (1 + ε) * totalShell < Real.exp (-Q) := by have h := affine_error_envelope_le_precision hε hT hshell linarith [Real.exp_pos (-Q)]
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107import OAI.Combinatorics.Progressions.Polynomial.AffineDegreeChoice
namespace OAI
section
namespace Erdos3
noncomputable def affineComparisonTail (ε L T : ℝ) : ℕ := CyclicCrootSisask.spectralIterations (ε / (2 + ε)) (L + 2 * T + 4)
noncomputable def affineComparisonScale (ε L T C : ℝ) : ℝ := L + T + 2 + (affineRemovalDepth T + affineComparisonTail ε L T : ℕ) + C
noncomputable def affineComparisonMoment (P : ℝ) : ℕ := 2 * (Nat.floor (P / 2) + 1)
theorem affineComparisonScale_bounds {ε L T C : ℝ} (hL : 0 ≤ L) (hT : 0 ≤ T) (hC : 0 ≤ C) : 0 ≤ affineComparisonScale ε L T C ∧ L + T + 2 ≤ affineComparisonScale ε L T C ∧ ((affineRemovalDepth T + affineComparisonTail ε L T : ℕ) : ℝ) ≤ affineComparisonScale ε L T C ∧ C ≤ affineComparisonScale ε L T C := by have hn : (0 : ℝ) ≤ (affineRemovalDepth T + affineComparisonTail ε L T : ℕ) := Nat.cast_nonneg _ unfold affineComparisonScale constructor · positivity constructor · linarith constructor <;> linarith
theorem affineComparisonScale_count {ι : Type*} [Fintype ι] {ε L T C : ℝ} (hL : 0 ≤ L) (hT : 0 ≤ T) (hC : 0 ≤ C) (hcount : (Fintype.card ι : ℝ) ≤ Real.exp C) : (Fintype.card ι : ℝ) ≤ Real.exp (affineComparisonScale ε L T C) := hcount.trans (Real.exp_le_exp.mpr (affineComparisonScale_bounds (ε := ε) hL hT hC).2.2.2)
theorem affineComparisonMoment_bounds {P : ℝ} (hP : 0 ≤ P) : 2 ≤ affineComparisonMoment P ∧ Even (affineComparisonMoment P) ∧ P ≤ (affineComparisonMoment P : ℝ) ∧ (affineComparisonMoment P : ℝ) ≤ P + 2 := by unfold affineComparisonMoment refine ⟨by omega, even_two_mul _, ?_, ?_⟩ · have h := Nat.lt_floor_add_one (P / 2) push_cast linarith · have h := Nat.floor_le (by positivity : 0 ≤ P / 2) push_cast linarith
end Erdos3
end
section
namespace Erdos3
noncomputable def affinePrimitiveLogBudget (P : ℝ) : ℝ := 16 * (P + 3)
theorem affinePrimitiveLogBudget_nonneg {P : ℝ} (hP : 0 ≤ P) : 0 ≤ affinePrimitiveLogBudget P := by unfold affinePrimitiveLogBudget; positivity
theorem affineRemovalDepth_le_logBudget {T P : ℝ} (hT : 0 ≤ T) (hTP : T ≤ P) : (affineRemovalDepth T : ℝ) ≤ 2 * P + 10 := by have h := CyclicCrootSisask.spectralIterations_le_logBudget (epsilon := 1) (A := 0) (by norm_num) hT le_rfl (by simp) change (affineRemovalDepth T : ℝ) ≤ _ at h linarith
theorem affineComparisonTail_le_logBudget {epsilon L T P : ℝ} (hepsilon : 0 < epsilon) (hepsilon1 : epsilon ≤ 1) (hP : 0 ≤ P) (hL : 0 ≤ L) (hT : 0 ≤ T) (hLP : L ≤ P) (hTP : T ≤ P) (hinverse : epsilon⁻¹ ≤ Real.exp P) : (affineComparisonTail epsilon L T : ℝ) ≤ 8 * P + 22 := by have h := CyclicCrootSisask.spectralIterations_le_logBudget (epsilon := epsilon / (2 + epsilon)) (p := L + 2 * T + 4) (A := P + 2) (by positivity) (by positivity) (by positivity) (affineAllowance_inverse_le_exp hepsilon hepsilon1 hinverse) change (affineComparisonTail epsilon L T : ℝ) ≤ _ at h linarith
theorem affineComparisonPrimitive_bounds {epsilon L T C P : ℝ} (hepsilon : 0 < epsilon) (hepsilon1 : epsilon ≤ 1) (hP : 0 ≤ P) (hL : 0 ≤ L) (hT : 0 ≤ T) (hC : 0 ≤ C) (hLP : L ≤ P) (hTP : T ≤ P) (hCP : C ≤ P) (hinverse : epsilon⁻¹ ≤ Real.exp P) : ((affineRemovalDepth T + affineComparisonTail epsilon L T : ℕ) : ℝ) ≤ affinePrimitiveLogBudget P ∧ affineComparisonScale epsilon L T C ≤ affinePrimitiveLogBudget P ∧ (affineComparisonMoment (affineComparisonScale epsilon L T C) : ℝ) ≤ affinePrimitiveLogBudget P + 2 := by have hj := affineRemovalDepth_le_logBudget hT hTP have ht := affineComparisonTail_le_logBudget hepsilon hepsilon1 hP hL hT hLP hTP hinverse have hsum : ((affineRemovalDepth T + affineComparisonTail epsilon L T : ℕ) : ℝ) ≤ 10 * P + 32 := by push_cast; linarith have hs : affineComparisonScale epsilon L T C ≤ affinePrimitiveLogBudget P := by unfold affineComparisonScale affinePrimitiveLogBudget linarith refine ⟨?_, hs, ?_⟩ · unfold affinePrimitiveLogBudget linarith · have hm := (affineComparisonMoment_bounds (affineComparisonScale_bounds (ε := epsilon) hL hT hC).1).2.2.2 linarith
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445import OAI.Combinatorics.Progressions.Geometry.ScalarSupportTranslationL1
namespace OAI
section
namespace Erdos3
open MeasureTheoryopen scoped BigOperators
theorem affineProductProfile_translation_l1 {I : Type*} [Fintype I] (c w : I → ℝ) {δ : ℝ} (hδ : 0 < δ) (hw : ∀ i, δ ≤ w i) (a b : I → ℝ) : (∫ x, |affineProductProfile c w (x + a) - affineProductProfile c w (x + b)|) ≤ (Fintype.card I * (4 * (probabilityProfileLipschitz : ℝ) / δ)) * dist a b := by classical have hwp (i) : 0 < w i := hδ.trans_le (hw i) have hi (z : I → ℝ) (i) : Integrable (fun x => affineProbabilityProfile (c i) (w i) (x + z i)) := (affineProbabilityProfile_integrable (c i) (hwp i)).comp_add_right (z i) have hm (z : I → ℝ) (i) : (∫ x, affineProbabilityProfile (c i) (w i) (x + z i)) = 1 := by rw [integral_add_right_eq_self, affineProbabilityProfile_integral (c i) (hwp i)] have h := product_density_l1_le_sum (fun i x => affineProbabilityProfile (c i) (w i) (x + a i)) (fun i x => affineProbabilityProfile (c i) (w i) (x + b i)) (hi a) (hi b) (fun i _ => affineProbabilityProfile_nonneg (c i) (hwp i) _) (fun i _ => affineProbabilityProfile_nonneg (c i) (hwp i) _) (hm a) (hm b) change (∫ x, |affineProductProfile c w (x + a) - affineProductProfile c w (x + b)|) ≤ _ at h refine h.trans ?_ calc _ ≤ ∑ _i : I, (4 * (probabilityProfileLipschitz : ℝ) / δ) * dist a b := by apply Finset.sum_le_sum intro i _ apply (affineProbabilityProfile_translation_l1 (c i) (a i) (b i) (hwp i)).trans apply mul_le_mul · exact div_le_div_of_nonneg_left (by positivity) hδ (hw i) · simpa only [Real.dist_eq] using dist_le_pi_dist a b i · exact abs_nonneg _ · positivity _ = _ := by simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul]; ring
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233import OAI.Combinatorics.Progressions.Linear.SharedFreeCommonProjection
namespace OAI
section
namespace Erdos3.VectorPolynomial
open scoped TensorProduct BigOperators
theorem affine_refined_coefficient_mem {L ι : Type*} [AddCommGroup L] [Module ℚ L] [Fintype ι] {s : ℕ} (C D : Fin s → Submodule ℚ L) (K : Fin s → Submodule ℚ (Fin 4 → L)) (G : VectorPolynomial Unit ℚ (ℝ ⊗[ℚ] L)) (α : Fin s → ℝ ⊗[ℚ] L) (β : ι → Fin s → ℝ ⊗[ℚ] L) (x : ι → ℝ) (hG : ∀ d : Fin s, coefficients G (Finsupp.single () (d.val + 1)) ∈ ((fourRefinedRelation (C d) (D d) (K d)).map (LinearMap.proj 0)).baseChange ℝ) (hα : ∀ d, α d ∈ (D d).baseChange ℝ) (hβ : ∀ j d, β j d ∈ (D d).baseChange ℝ) (d : Fin s) : coefficients (G + positiveUnivariate (fun d => α d + ∑ j, x j • β j d)) (Finsupp.single () (d.val + 1)) ∈ ((fourRefinedRelation (C d) (D d) (K d)).map (LinearMap.proj 0)).baseChange ℝ := by rw [map_add, Finsupp.add_apply, positiveUnivariate_coefficient] apply Submodule.add_mem _ (hG d) apply Submodule.baseChange_mono ℝ (dependent_le_refined_firstProjection (C d) (D d) (K d)) exact Submodule.add_mem _ (hα d) (Submodule.sum_mem _ (fun j _ => Submodule.smul_mem _ _ (hβ j d)))
end Erdos3.VectorPolynomial
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071import OAI.Combinatorics.Progressions.Linear.WeightedPatchKernel
namespace OAI
section
namespace Erdos3
open scoped NNReal
def recoveredIntegerLift {d m : ℕ} (M : Fin m → Fin d → ℤ) (c : Fin m → ℤ) (k : Fin d → ℤ) : Fin m → ℤ := fun i => c i + ∑ j, M i j * k j
noncomputable def realIntegerMatrix {d m : ℕ} (M : Fin m → Fin d → ℤ) (x : Fin d → ℝ) : Fin m → ℝ := fun i => ∑ j, (M i j : ℝ) * x j
noncomputable def recoveredSmallLift {d m : ℕ} (M : Fin m → Fin d → ℤ) (a : Fin d → ℝ) (c : Fin m → ℤ) (e : Fin d → ℝ) : Fin m → ℝ := fun i => (∑ j, (M i j : ℝ) * (a j - e j)) - c i
theorem recoveredSmallLift_at_integer {d m : ℕ} (M : Fin m → Fin d → ℤ) (a x : Fin d → ℝ) (c : Fin m → ℤ) (k : Fin d → ℤ) : recoveredSmallLift M a c (fun j => (k j : ℝ) - (x - a) j) = fun i => realIntegerMatrix M x i - (recoveredIntegerLift M c k i : ℝ) := by funext i simp only [recoveredSmallLift, realIntegerMatrix, recoveredIntegerLift, Pi.sub_apply] push_cast simp only [mul_sub, Finset.sum_sub_distrib] ring
theorem recoveredSmallLift_lipschitz {d m : ℕ} (M : Fin m → Fin d → ℤ) (a : Fin d → ℝ) (c : Fin m → ℤ) (K : ℝ≥0) (hM : ∀ i, (∑ j, |(M i j : ℝ)|) ≤ K) : LipschitzWith K (recoveredSmallLift M a c) := by apply LipschitzWith.of_dist_le_mul intro x y apply (dist_pi_le_iff (mul_nonneg K.coe_nonneg dist_nonneg)).mpr intro i simp only [recoveredSmallLift, Real.dist_eq] rw [sub_sub_sub_cancel_right, ← Finset.sum_sub_distrib] calc _ ≤ ∑ j, |(M i j : ℝ) * (a j - x j) - (M i j : ℝ) * (a j - y j)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ j, |(M i j : ℝ)| * dist x y := by apply Finset.sum_le_sum intro j _ rw [← mul_sub, abs_mul] apply mul_le_mul_of_nonneg_left _ (abs_nonneg _) simpa only [sub_sub_sub_cancel_left, abs_sub_comm, Real.dist_eq] using dist_le_pi_dist x y j _ = (∑ j, |(M i j : ℝ)|) * dist x y := (Finset.sum_mul _ _ _).symm _ ≤ K * dist x y := mul_le_mul_of_nonneg_right (hM i) dist_nonneg
noncomputable def recoveredCellKernel {d m : ℕ} (Φ : PatchKernel d) (Ψ : PatchKernel m) (M : Fin m → Fin d → ℤ) (a : Fin d → ℝ) (c : Fin m → ℤ) (K : ℝ≥0) (hM : ∀ i, (∑ j, |(M i j : ℝ)|) ≤ K) : PatchKernel d := Φ.weightAlong Ψ (recoveredSmallLift M a c) K (recoveredSmallLift_lipschitz M a c K hM)
@[simp] theorem recoveredCellKernel_lip {d m : ℕ} (Φ : PatchKernel d) (Ψ : PatchKernel m) (M : Fin m → Fin d → ℤ) (a : Fin d → ℝ) (c : Fin m → ℤ) (K : ℝ≥0) (hM : ∀ i, (∑ j, |(M i j : ℝ)|) ≤ K) : (recoveredCellKernel Φ Ψ M a c K hM).lip = Φ.lip + Ψ.lip * K := rfl
@[simp] theorem recoveredCellKernel_value {d m : ℕ} (Φ : PatchKernel d) (Ψ : PatchKernel m) (M : Fin m → Fin d → ℤ) (a : Fin d → ℝ) (c : Fin m → ℤ) (K : ℝ≥0) (hM : ∀ i, (∑ j, |(M i j : ℝ)|) ≤ K) (e : Fin d → ℝ) : (recoveredCellKernel Φ Ψ M a c K hM).value e = Φ.value e * Ψ.value (recoveredSmallLift M a c e) := rfl
end Erdos3
end
end OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879import OAI.Combinatorics.Progressions.Estimates.PhysicalPairAccuracyLogBounds
namespace OAI
section
namespace Erdos3
noncomputable def affineComparisonAccuracyLog (b : ℕ) (P L T : ℝ) : ℝ := (P + 3) ^ 3 + 2 * (b : ℝ) * (P + 2) + L + T + 4
noncomputable def affineComparisonAccuracy (b : ℕ) (P L T : ℝ) : ℝ := Real.exp (-affineComparisonAccuracyLog b P L T)
theorem affineComparisonAccuracy_bounds {P L T level : ℝ} (b : ℕ) (hP : 0 ≤ P) (hL : 0 ≤ L) (hT : 0 ≤ T) (hlevel : Real.exp (-L) ≤ level) : 0 < affineComparisonAccuracy b P L T ∧ affineComparisonAccuracy b P L T < 1 ∧ affineComparisonAccuracy b P L T ≤ Real.exp (-T) / 8 ∧ affineComparisonAccuracy b P L T ≤ level * Real.exp (-T) / 8 ∧ affineComparisonAccuracy b P L T ≤ (1 / 2) * Real.exp (-((P + 3) ^ 3)) := by have hp : 0 ≤ (P + 3) ^ 3 := by positivity have hb : 0 ≤ 2 * (b : ℝ) * (P + 2) := by positivity have hpos : 0 < affineComparisonAccuracyLog b P L T := by unfold affineComparisonAccuracyLog linarith refine ⟨Real.exp_pos _, ?_, ?_, ?_, ?_⟩ · exact Real.exp_lt_one_iff.mpr (by linarith) · exact exp_neg_le_exp_neg_div_eight (by unfold affineComparisonAccuracyLog; linarith) · calc _ ≤ Real.exp (-(L + T)) / 8 := exp_neg_le_exp_neg_div_eight (by unfold affineComparisonAccuracyLog; linarith) _ ≤ level * Real.exp (-T) / 8 := by rw [neg_add, Real.exp_add] exact div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_right hlevel (Real.exp_pos _).le) (by norm_num) · exact exp_neg_le_half_exp_neg (by unfold affineComparisonAccuracyLog; linarith)
theorem affineComparisonAccuracy_gram {ι : Type*} [Fintype ι] [DecidableEq ι] {P L T : ℝ} (b : ℕ) (hP : 0 ≤ P) (hL : 0 ≤ L) (hT : 0 ≤ T) (hcount : (Fintype.card ι : ℝ) ≤ Real.exp P) : 2 * affineComparisonAccuracy b P L T * ((lowDegreeCoordinateSets ι b).card : ℝ) ^ 2 * (4 : ℝ) ^ b * (1 + affineComparisonAccuracy b P L T) ^ 2 ≤ Real.exp (-T) := by let η := affineComparisonAccuracy b P L T have he := affineComparisonAccuracy_bounds (level := Real.exp (-L)) b hP hL hT le_rfl have hη0 : 0 < η := he.1 have hη1 : η < 1 := he.2.1 have hc := lowDegreeCoordinateSets_card_le_exp hP hcount b have hc2 : ((lowDegreeCoordinateSets ι b).card : ℝ) ^ 2 ≤ Real.exp (2 * (b : ℝ) * (P + 1)) := by calc _ ≤ (Real.exp ((b : ℝ) * (P + 1))) ^ 2 := pow_le_pow_left₀ (Nat.cast_nonneg _) hc 2 _ = _ := by rw [← Real.exp_nat_mul]; congr 1; ring have htwo : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp (1 : ℝ)] have hfour : (4 : ℝ) ≤ Real.exp 2 := by calc 4 = (2 : ℝ) ^ 2 := by norm_num _ ≤ (Real.exp 1) ^ 2 := pow_le_pow_left₀ (by norm_num) htwo 2 _ = _ := by rw [← Real.exp_nat_mul]; norm_num have hp4 : (4 : ℝ) ^ b ≤ Real.exp (2 * (b : ℝ)) := by exact (pow_le_pow_left₀ (by norm_num) hfour b).trans_eq (by rw [← Real.exp_nat_mul]; congr 1; ring) have hsq : (1 + η) ^ 2 ≤ 4 := by nlinarith have hsmall : η ≤ Real.exp (-(2 * (b : ℝ) * (P + 2) + T)) / 8 := by apply exp_neg_le_exp_neg_div_eight unfold affineComparisonAccuracyLog have hp : 0 ≤ (P + 3) ^ 3 := by positivity linarith change 2 * η * _ ^ 2 * _ ^ b * (1 + η) ^ 2 ≤ _ calc _ ≤ 2 * η * Real.exp (2 * (b : ℝ) * (P + 1)) * Real.exp (2 * (b : ℝ)) * 4 := by gcongr _ = 8 * η * (Real.exp (2 * (b : ℝ) * (P + 1)) * Real.exp (2 * (b : ℝ))) := by ring _ = 8 * η * Real.exp (2 * (b : ℝ) * (P + 2)) := by rw [← Real.exp_add]; congr 2; ring _ ≤ 8 * (Real.exp (-(2 * (b : ℝ) * (P + 2) + T)) / 8) * Real.exp (2 * (b : ℝ) * (P + 2)) := by gcongr _ = Real.exp (-(2 * (b : ℝ) * (P + 2) + T)) * Real.exp (2 * (b : ℝ) * (P + 2)) := by ring _ = Real.exp (-T) := by rw [← Real.exp_add]; congr 1; ring
end Erdos3
end
end OAI12345678910111213141516171819202122232425262728293031import Mathlib.Algebra.Group.Equiv.Basicimport Mathlib.Algebra.Group.Units.Equivimport Mathlib.Data.ZMod.Basic
namespace OAI
section
namespace Erdos3
noncomputable def affineResidueCoordinateEquiv {σ : Type*} (M q : ℕ) (a : σ → ℤ) (hcop : M.Coprime q) : (σ → ZMod q) ≃ (σ → ZMod q) := Equiv.piCongrRight fun j => (ZMod.unitOfCoprime M hcop).mulLeft.trans (Equiv.addLeft (a j : ZMod q))
theorem affineResidueCoordinateEquiv_apply {σ : Type*} (M q : ℕ) (a : σ → ℤ) (hcop : M.Coprime q) (x : σ → ZMod q) (j : σ) : affineResidueCoordinateEquiv M q a hcop x j = (a j : ZMod q) + (M : ZMod q) * x j := rfl
theorem affineResidueCoordinateEquiv_intCast {σ : Type*} (M q : ℕ) (a : σ → ℤ) (hcop : M.Coprime q) (z : σ → ℤ) : affineResidueCoordinateEquiv M q a hcop (fun j => (z j : ZMod q)) = (fun j => ((a j + (M : ℤ) * z j : ℤ) : ZMod q)) := by funext j simp only [affineResidueCoordinateEquiv_apply, Int.cast_add, Int.cast_mul, Int.cast_natCast]
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635import Mathlib.Data.ZMod.Basicimport OAI.Combinatorics.Progressions.Lattices.PrimeCoordinateCellsimport OAI.Combinatorics.Progressions.Linear.KernelCoreComparison
namespace OAI
section
namespace Erdos3
open scoped BigOperators Classical
variable {q : ℕ} [NeZero q] {J G : Type*} [Fintype J] [AddCommGroup G] [Module (ZMod q) G]
noncomputable def residueColumnMap (V : J → G) : (J → ZMod q) →+ G where toFun t := ∑ j, t j • V j map_zero' := by simp map_add' t u := by simp [add_smul, Finset.sum_add_distrib]
omit [NeZero q] intheorem residueColumnMap_single (V : J → G) (j : J) : residueColumnMap (q := q) V (Pi.single j (1 : ZMod q)) = V j := by simp [residueColumnMap, Pi.single_apply, ite_smul]
theorem additiveCharacter_zmod_smul (χ : AddChar G ℂ) (t : ZMod q) (x : G) : χ (t • x) = χ x ^ t.val := by conv_lhs => rw [← ZMod.natCast_zmod_val t, Nat.cast_smul_eq_nsmul] exact χ.map_nsmul_eq_pow t.val x
theorem residueColumn_character_zero_iff (V : J → G) (χ : AddChar G ℂ) : χ.compAddMonoidHom (residueColumnMap (q := q) V) = 0 ↔ ∀ j, χ (V j) = 1 := by constructor · intro h j have hh := DFunLike.congr_fun h (Pi.single j (1 : ZMod q)) simpa only [AddChar.compAddMonoidHom_apply, residueColumnMap_single, AddChar.zero_apply] using hh · intro h ext t change χ (∑ j, t j • V j) = 1 exact (additiveCharacterKernel χ).sum_mem (fun j _ => by change χ (t j • V j) = 1 rw [additiveCharacter_zmod_smul, h, one_pow])
theorem residueColumn_character_mean (V : J → G) (χ : AddChar G ℂ) : (𝔼 t : J → ZMod q, χ (residueColumnMap (q := q) V t)) = if ∀ j, χ (V j) = 1 then 1 else 0 := by have h := AddChar.expect_eq_ite (χ.compAddMonoidHom (residueColumnMap (q := q) V)) simpa only [AddChar.compAddMonoidHom_apply, residueColumn_character_zero_iff] using h
noncomputable def residueColumnAverage (V : J → G) (f : G → ℂ) (x : G) : ℂ := 𝔼 t : J → ZMod q, f (x + residueColumnMap (q := q) V t)
variable [Fintype G]
theorem finiteFourierCoeff_residueColumnAverage (V : J → G) (f : G → ℂ) (χ : AddChar G ℂ) : finiteFourierCoeff (residueColumnAverage (q := q) V f) χ = (if ∀ j, χ (V j) = 1 then 1 else 0) * finiteFourierCoeff f χ := by have htranslate (a : G) : finiteFourierCoeff (fun x => f (x + a)) χ = χ a * finiteFourierCoeff f χ := by have h := finiteFourierCoeff_translate f (-a) χ rw [AddChar.map_neg_eq_conj] at h simpa only [sub_neg_eq_add, Complex.star_def, starRingEnd_self_apply] using h unfold finiteFourierCoeff residueColumnAverage simp_rw [Finset.expect_mul] rw [Finset.expect_comm] change (𝔼 t : J → ZMod q, finiteFourierCoeff (fun x => f (x + residueColumnMap (q := q) V t)) χ) = _ simp_rw [htranslate] rw [← Finset.expect_mul, residueColumn_character_mean] rfl
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
variable {J G : Type*} [Fintype J] [AddCommGroup G] [Fintype G]
theorem residueColumn_survival_probability (χ : AddChar G ℂ) : (𝔼 V : J → G, if ∀ j, χ (V j) = 1 then (1 : ℝ) else 0) = (𝔼 x : G, if χ x = 1 then (1 : ℝ) else 0) ^ Fintype.card J := by have hpoint (V : J → G) : (if ∀ j, χ (V j) = 1 then (1 : ℝ) else 0) = ∏ j, if χ (V j) = 1 then (1 : ℝ) else 0 := by by_cases h : ∀ j, χ (V j) = 1 · simp [h] · rw [ite_eq_right h] push Not at h obtain ⟨j, hj⟩ := h exact (Finset.prod_eq_zero (Finset.mem_univ j) (by simp [hj])).symm calc _ = 𝔼 V : J → G, ∏ j, if χ (V j) = 1 then (1 : ℝ) else 0 := Finset.expect_congr rfl (fun V _ => hpoint V) _ = (∑ x : G, if χ x = 1 then (1 : ℝ) else 0) ^ Fintype.card J / (Fintype.card G : ℝ) ^ Fintype.card J := by rw [Fintype.expect_eq_sum_div_card, Fintype.card_fun, Nat.cast_pow] congr 1 simpa using (Fintype.prod_sum (fun _j : J => fun x : G => if χ x = 1 then (1 : ℝ) else 0)).symm _ = _ := by rw [Fintype.expect_eq_sum_div_card, div_pow]
variable {q : ℕ} [NeZero q] [Module (ZMod q) G]
theorem residueColumnAverage_energy (V : J → G) (f : G → ℂ) : (𝔼 x : G, ‖residueColumnAverage (q := q) V f x‖ ^ 2) = ∑ χ : AddChar G ℂ, (if ∀ j, χ (V j) = 1 then (1 : ℝ) else 0) * ‖finiteFourierCoeff f χ‖ ^ 2 := by rw [← finiteFourier_parseval] apply Finset.sum_congr rfl intro χ _ rw [finiteFourierCoeff_residueColumnAverage] split_ifs <;> simp
theorem residueColumnAverage_mean_energy (f : G → ℂ) : (𝔼 V : J → G, 𝔼 x : G, ‖residueColumnAverage (q := q) V f x‖ ^ 2) = ∑ χ : AddChar G ℂ, (𝔼 x : G, if χ x = 1 then (1 : ℝ) else 0) ^ Fintype.card J * ‖finiteFourierCoeff f χ‖ ^ 2 := by simp_rw [residueColumnAverage_energy] rw [Finset.expect_sum_comm] apply Finset.sum_congr rfl intro χ _ rw [← Finset.expect_mul, residueColumn_survival_probability]
theorem primeAffine_contraction_sq {p a : ℕ} (hp : p.Prime) (hG : Fintype.card G = p ^ a) (f : G → ℂ) (hf : (𝔼 x, f x) = 0) : (𝔼 V : J → G, 𝔼 x : G, ‖residueColumnAverage (q := q) V f x‖ ^ 2) ≤ (p : ℝ)⁻¹ ^ Fintype.card J * (𝔼 x : G, ‖f x‖ ^ 2) := by rw [residueColumnAverage_mean_energy] calc _ ≤ ∑ χ : AddChar G ℂ, (p : ℝ)⁻¹ ^ Fintype.card J * ‖finiteFourierCoeff f χ‖ ^ 2 := by apply Finset.sum_le_sum intro χ _ by_cases hχ : χ = 0 · subst χ have hz : finiteFourierCoeff f 0 = 0 := by simpa [finiteFourierCoeff] using hf simp [hz] · apply mul_le_mul_of_nonneg_right _ (sq_nonneg _) exact pow_le_pow_left₀ (Finset.expect_nonneg (fun x _ => by split_ifs <;> norm_num)) (primePowerCharacter_kernel_probability hp hG hχ) _ _ = _ := by rw [← Finset.mul_sum, finiteFourier_parseval]
theorem primeAffine_contraction {p a : ℕ} (hp : p.Prime) (hG : Fintype.card G = p ^ a) (f : G → ℂ) (hf : (𝔼 x, f x) = 0) : Real.sqrt (𝔼 V : J → G, 𝔼 x : G, ‖residueColumnAverage (q := q) V f x‖ ^ 2) ≤ (p : ℝ) ^ (-(Fintype.card J : ℝ) / 2) * Real.sqrt (𝔼 x : G, ‖f x‖ ^ 2) := by have hs : Real.sqrt ((p : ℝ)⁻¹ ^ Fintype.card J) = (p : ℝ) ^ (-(Fintype.card J : ℝ) / 2) := by rw [Real.sqrt_eq_rpow] calc _ = ((p : ℝ) ^ (-(Fintype.card J : ℝ))) ^ (1 / (2 : ℝ)) := by rw [Real.rpow_neg (Nat.cast_nonneg p), Real.rpow_natCast, inv_pow] _ = (p : ℝ) ^ (-(Fintype.card J : ℝ) * (1 / 2)) := (Real.rpow_mul (Nat.cast_nonneg p) _ _).symm _ = _ := by congr 1; ring calc _ ≤ Real.sqrt ((p : ℝ)⁻¹ ^ Fintype.card J * (𝔼 x : G, ‖f x‖ ^ 2)) := Real.sqrt_le_sqrt (primeAffine_contraction_sq (q := q) hp hG f hf) _ = _ := by rw [Real.sqrt_mul (by positivity), hs]
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
variable {I J : Type*} [Fintype I] [Fintype J] {p a : ℕ} [NeZero (p ^ a)]
theorem primePowerResidue_contraction_sq (hp : p.Prime) (f : (I → ZMod (p ^ a)) → ℂ) (hf : (𝔼 x, f x) = 0) : (𝔼 V : J → I → ZMod (p ^ a), 𝔼 X : I → ZMod (p ^ a), ‖𝔼 t : J → ZMod (p ^ a), f (X + ∑ j, t j • V j)‖ ^ 2) ≤ (p : ℝ)⁻¹ ^ Fintype.card J * (𝔼 X, ‖f X‖ ^ 2) := by have hG : Fintype.card (I → ZMod (p ^ a)) = p ^ (a * Fintype.card I) := by simp [pow_mul] simpa only [residueColumnAverage, residueColumnMap, AddMonoidHom.coe_mk, ZeroHom.coe_mk] using primeAffine_contraction_sq (J := J) (q := p ^ a) hp hG f hf
theorem primePowerResidue_contraction (hp : p.Prime) (f : (I → ZMod (p ^ a)) → ℂ) (hf : (𝔼 x, f x) = 0) : Real.sqrt (𝔼 V : J → I → ZMod (p ^ a), 𝔼 X : I → ZMod (p ^ a), ‖𝔼 t : J → ZMod (p ^ a), f (X + ∑ j, t j • V j)‖ ^ 2) ≤ (p : ℝ) ^ (-(Fintype.card J : ℝ) / 2) * Real.sqrt (𝔼 X, ‖f X‖ ^ 2) := by have hG : Fintype.card (I → ZMod (p ^ a)) = p ^ (a * Fintype.card I) := by simp [pow_mul] simpa only [residueColumnAverage, residueColumnMap, AddMonoidHom.coe_mk, ZeroHom.coe_mk] using primeAffine_contraction (J := J) (q := p ^ a) hp hG f hf
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
variable {q : ℕ} [NeZero q] {J G : Type*} [Fintype J] [AddCommGroup G] [Module (ZMod q) G]
noncomputable def residueColumnRealAverage (V : J → G) (f : G → ℝ) (x : G) : ℝ := 𝔼 t : J → ZMod q, f (x + residueColumnMap (q := q) V t)
theorem residueColumnAverage_ofReal (V : J → G) (f : G → ℝ) (x : G) : residueColumnAverage (q := q) V (fun y => (f y : ℂ)) x = (residueColumnRealAverage (q := q) V f x : ℂ) := by simp only [residueColumnAverage, residueColumnRealAverage, Fintype.expect_eq_sum_div_card, Complex.ofReal_div, Complex.ofReal_sum, Complex.ofReal_natCast]
variable [Fintype G]
theorem residueColumnRealAverage_mean (V : J → G) (f : G → ℝ) : (𝔼 x : G, residueColumnRealAverage (q := q) V f x) = 𝔼 x : G, f x := by unfold residueColumnRealAverage rw [Finset.expect_comm] have hshift (t : J → ZMod q) : (𝔼 x : G, f (x + residueColumnMap (q := q) V t)) = 𝔼 x : G, f x := Fintype.expect_equiv (Equiv.addRight (residueColumnMap (q := q) V t)) _ _ (fun _ => rfl) simp only [hshift, Fintype.expect_const]
theorem primeAffine_real_contraction_sq {p a : ℕ} (hp : p.Prime) (hG : Fintype.card G = p ^ a) (f : G → ℝ) (hf : (𝔼 x, f x) = 0) : (𝔼 V : J → G, 𝔼 x : G, residueColumnRealAverage (q := q) V f x ^ 2) ≤ (p : ℝ)⁻¹ ^ Fintype.card J * (𝔼 x : G, f x ^ 2) := by have hfc : (𝔼 x : G, (f x : ℂ)) = 0 := by have hc := congrArg (fun y : ℝ => (y : ℂ)) hf simpa only [Fintype.expect_eq_sum_div_card, Complex.ofReal_div, Complex.ofReal_sum, Complex.ofReal_natCast, Complex.ofReal_zero] using hc have h := primeAffine_contraction_sq (q := q) (J := J) hp hG (fun x => (f x : ℂ)) hfc simpa only [residueColumnAverage_ofReal, Complex.norm_real, Real.norm_eq_abs, sq_abs] using h
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
variable {q : ℕ} [NeZero q] {J G : Type*} [Fintype J] [AddCommGroup G] [Module (ZMod q) G] [Fintype G]
noncomputable def residueAffineSource : FiniteProbabilityWeights ((J → G) × G) := (FiniteProbabilityWeights.uniform (J → G)).prod (FiniteProbabilityWeights.uniform G)
noncomputable def residueAffineKernel (z : (J → G) × G) : FiniteProbabilityWeights G := (FiniteProbabilityWeights.uniform (J → ZMod q)).fiberLaw (fun t => z.2 + residueColumnMap (q := q) z.1 t)
theorem residueAffineKernel_mean (z : (J → G) × G) (f : G → ℝ) : (residueAffineKernel (q := q) z).mean f = residueColumnRealAverage (q := q) z.1 f z.2 := by rw [residueAffineKernel, FiniteProbabilityWeights.fiberLaw_mean, FiniteProbabilityWeights.uniform_mean] rfl
theorem residueAffineKernel_preserves_mean (f : G → ℝ) : (residueAffineSource (J := J) (G := G)).mean (fun z => (residueAffineKernel (q := q) z).mean f) = (FiniteProbabilityWeights.uniform G).mean f := by simp only [residueAffineSource, FiniteProbabilityWeights.mean_prod, residueAffineKernel_mean, FiniteProbabilityWeights.uniform_mean, residueColumnRealAverage_mean, Fintype.expect_const]
noncomputable def residueAffineCoupling : FiniteProbabilityCoupling (residueAffineSource (J := J) (G := G)) (FiniteProbabilityWeights.uniform G) := FiniteProbabilityCoupling.ofKernel _ _ (residueAffineKernel (q := q)) (residueAffineKernel_preserves_mean (q := q))
theorem residueAffineKernel_centered_sq {p a : ℕ} (hp : p.Prime) (hG : Fintype.card G = p ^ a) (f : G → ℝ) (hf : (FiniteProbabilityWeights.uniform G).mean f = 0) : (residueAffineSource (J := J) (G := G)).mean (fun z => (residueAffineKernel (q := q) z).mean f ^ 2) ≤ (p : ℝ)⁻¹ ^ Fintype.card J * (FiniteProbabilityWeights.uniform G).mean (fun x => f x ^ 2) := by simp only [residueAffineSource, FiniteProbabilityWeights.mean_prod, residueAffineKernel_mean, FiniteProbabilityWeights.uniform_mean] exact primeAffine_real_contraction_sq hp hG f (by simpa only [FiniteProbabilityWeights.uniform_mean] using hf)
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
variable {ι J : Type*} [Fintype ι] [DecidableEq ι] [Fintype J] (p q a : ι → ℕ) [∀ i, NeZero (q i)] {G : ι → Type*} [∀ i, AddCommGroup (G i)] [∀ i, Module (ZMod (q i)) (G i)] [∀ i, Fintype (G i)] (hp : ∀ i, (p i).Prime) (hcard : ∀ i, Fintype.card (G i) = p i ^ a i)
include hp hcard
theorem affineCoupling_level_abs_le {κ : ℝ} (hκ : 0 ≤ κ) (hcap : ∀ i, (p i : ℝ)⁻¹ ^ Fintype.card J ≤ κ ^ 2) (k : ℕ) (w : (∀ i, (J → G i) × G i) → ℝ) (f : (∀ i, G i) → ℝ) : let μ := fun i => residueAffineSource (J := J) (G := G i) let ν := fun i => FiniteProbabilityWeights.uniform (G i) |productCouplingPairing (fun i => residueAffineCoupling (q := q i) (J := J) (G := G i)) (productANOVATruncation μ (Finset.univ.powersetCard k) w) (productANOVATruncation ν (Finset.univ.powersetCard k) f)| ≤ κ ^ k * Real.sqrt (productANOVAEnergy μ (Finset.univ.powersetCard k) w) * Real.sqrt (productANOVAEnergy ν (Finset.univ.powersetCard k) f) := by exact productCouplingPairing_level_abs_le _ _ (fun i => residueAffineKernel (q := q i)) (fun i => (p i : ℝ)⁻¹ ^ Fintype.card J) (fun _ => by positivity) (fun i => residueAffineKernel_centered_sq (hp i) (hcard i)) (fun i => residueAffineKernel_preserves_mean (q := q i)) hκ hcap k w f
theorem affineCoupling_tail_abs_le {κ : ℝ} (hκ0 : 0 ≤ κ) (hκ1 : κ ≤ 1) (hcap : ∀ i, (p i : ℝ)⁻¹ ^ Fintype.card J ≤ κ ^ 2) (r : ℕ) (D : Finset (Finset ι)) (hmin : ∀ S ∈ D, r ≤ S.card) (w : (∀ i, (J → G i) × G i) → ℝ) (f : (∀ i, G i) → ℝ) : let μ := fun i => residueAffineSource (J := J) (G := G i) let ν := fun i => FiniteProbabilityWeights.uniform (G i) |productCouplingPairing (fun i => residueAffineCoupling (q := q i) (J := J) (G := G i)) (productANOVATruncation μ D w) (productANOVATruncation ν D f)| ≤ κ ^ r * Real.sqrt (productANOVAEnergy μ D w) * Real.sqrt (productANOVAEnergy ν D f) := by exact productCouplingPairing_tail_abs_le _ _ (fun i => residueAffineKernel (q := q i)) (fun i => (p i : ℝ)⁻¹ ^ Fintype.card J) (fun _ => by positivity) (fun i => residueAffineKernel_centered_sq (hp i) (hcard i)) (fun i => residueAffineKernel_preserves_mean (q := q i)) hκ0 hκ1 hcap r D hmin w f
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
theorem productAffine_centered_contraction_sq {ι J : Type*} [Fintype ι] [DecidableEq ι] [Fintype J] (p q a : ι → ℕ) [∀ i, NeZero (q i)] {G : ι → Type*} [∀ i, AddCommGroup (G i)] [∀ i, Module (ZMod (q i)) (G i)] [∀ i, Fintype (G i)] (hp : ∀ i, (p i).Prime) (hcard : ∀ i, Fintype.card (G i) = p i ^ a i) (f : (∀ i, G i) → ℝ) : (FiniteProbabilityWeights.pi (fun i => residueAffineSource (J := J) (G := G i))).mean (fun x => productMatrixApply (fun i => centeredKernelMatrix (FiniteProbabilityWeights.uniform (G i)) (residueAffineKernel (q := q i) (J := J))) f x ^ 2) ≤ (∏ i, (p i : ℝ)⁻¹ ^ Fintype.card J) * (FiniteProbabilityWeights.pi (fun i => FiniteProbabilityWeights.uniform (G i))).mean (fun y => f y ^ 2) := by apply productMatrixApply_sq_le _ _ _ (fun i => (p i : ℝ)⁻¹ ^ Fintype.card J) (fun _ => by positivity) intro i g apply centeredKernelMatrix_sq_le _ _ _ (by positivity) intro h hh exact residueAffineKernel_centered_sq (hp i) (hcard i) h hh
theorem productAffine_centered_pairing_sq {ι J : Type*} [Fintype ι] [DecidableEq ι] [Fintype J] (p q a : ι → ℕ) [∀ i, NeZero (q i)] {G : ι → Type*} [∀ i, AddCommGroup (G i)] [∀ i, Module (ZMod (q i)) (G i)] [∀ i, Fintype (G i)] (hp : ∀ i, (p i).Prime) (hcard : ∀ i, Fintype.card (G i) = p i ^ a i) (w : (∀ i, (J → G i) × G i) → ℝ) (f : (∀ i, G i) → ℝ) : ((FiniteProbabilityWeights.pi (fun i => residueAffineSource (J := J) (G := G i))).mean (fun x => w x * productMatrixApply (fun i => centeredKernelMatrix (FiniteProbabilityWeights.uniform (G i)) (residueAffineKernel (q := q i) (J := J))) f x)) ^ 2 ≤ (∏ i, (p i : ℝ)⁻¹ ^ Fintype.card J) * (FiniteProbabilityWeights.pi (fun i => residueAffineSource (J := J) (G := G i))).mean (fun x => w x ^ 2) * (FiniteProbabilityWeights.pi (fun i => FiniteProbabilityWeights.uniform (G i))).mean (fun y => f y ^ 2) := by apply productMatrixApply_pairing_sq_le _ _ _ (fun i => (p i : ℝ)⁻¹ ^ Fintype.card J) (fun _ => by positivity) intro i g apply centeredKernelMatrix_sq_le _ _ _ (by positivity) intro h hh exact residueAffineKernel_centered_sq (hp i) (hcard i) h hh
theorem productAffine_uniform_centered_sq {ι J : Type*} [Fintype ι] [DecidableEq ι] [Fintype J] (p q a : ι → ℕ) [∀ i, NeZero (q i)] {G : ι → Type*} [∀ i, AddCommGroup (G i)] [∀ i, Module (ZMod (q i)) (G i)] [∀ i, Fintype (G i)] (hp : ∀ i, (p i).Prime) (hcard : ∀ i, Fintype.card (G i) = p i ^ a i) {P : ℝ} (hP : 0 < P) (hmin : ∀ i, P ≤ (p i : ℝ)) (f : (∀ i, G i) → ℝ) : (FiniteProbabilityWeights.pi (fun i => residueAffineSource (J := J) (G := G i))).mean (fun x => productMatrixApply (fun i => centeredKernelMatrix (FiniteProbabilityWeights.uniform (G i)) (residueAffineKernel (q := q i) (J := J))) f x ^ 2) ≤ (P⁻¹ ^ Fintype.card J) ^ Fintype.card ι * (FiniteProbabilityWeights.pi (fun i => FiniteProbabilityWeights.uniform (G i))).mean (fun y => f y ^ 2) := by apply (productAffine_centered_contraction_sq p q a hp hcard f).trans apply mul_le_mul_of_nonneg_right _ (FiniteProbabilityWeights.mean_nonneg _ (fun y => sq_nonneg (f y))) have hi (i : ι) : (p i : ℝ)⁻¹ ≤ P⁻¹ := by simpa only [one_div] using one_div_le_one_div_of_le hP (hmin i) have hh := Finset.prod_le_prod₀ (s := (Finset.univ : Finset ι)) (fun i _ => pow_nonneg (inv_nonneg.mpr (Nat.cast_nonneg (p i))) (Fintype.card J)) (fun i _ => pow_le_pow_left₀ (inv_nonneg.mpr (Nat.cast_nonneg (p i))) (hi i) (Fintype.card J)) simpa only [Finset.prod_const, Finset.card_univ] using hh
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators
theorem primeCoordinateCell_mono {ι σ : Type*} [DecidableEq ι] [Fintype σ] [DecidableEq σ] (lo : σ → ℤ) (N : σ → ℕ) (q : ι → ℕ) {I J : Finset ι} {x y : ∀ i, σ → ZMod (q i)} (hIJ : I ⊆ J) (hxy : ∀ i ∈ I, y i = x i) : primeCoordinateCell lo N q J y ⊆ primeCoordinateCell lo N q I x := by intro z hz obtain ⟨hz, heq⟩ := (mem_primeCoordinateCell lo N q J y z).mp hz exact (mem_primeCoordinateCell lo N q I x z).mpr ⟨hz, fun i hi => (heq i (hIJ hi)).trans (hxy i hi)⟩
noncomputable def primeCoordinateMean {ι σ : Type*} [DecidableEq ι] [Fintype σ] [DecidableEq σ] (f : (σ → ℤ) → ℂ) (lo : σ → ℤ) (N : σ → ℕ) (q : ι → ℕ) (I : Finset ι) (x : ∀ i, σ → ZMod (q i)) : ℂ := 𝔼 z : primeCoordinateCell lo N q I x, f z.val
theorem primeCoordinateMean_eq_physical {ι σ : Type*} [DecidableEq ι] [Fintype σ] [DecidableEq σ] (f : (σ → ℤ) → ℂ) (lo : σ → ℤ) (N : σ → ℕ) (q : ι → ℕ) (hcop : Pairwise (fun i j => (q i).Coprime (q j))) (I : Finset ι) (x : ∀ i, σ → ZMod (q i)) (u : σ → ℤ) (hu : u ∈ primeCoordinateCell lo N q I x) : primeCoordinateMean f lo N q I x = physicalResidueMean f lo N (∏ i ∈ I, q i) u := by unfold primeCoordinateMean rw [primeCoordinateCell_anchor lo N q I x u hu] exact primeCoordinateCell_mean lo N q hcop I u f
noncomputable def PrimeCoordinateStable {ι σ : Type*} [DecidableEq ι] [Fintype σ] [DecidableEq σ] (f : (σ → ℤ) → ℂ) (lo : σ → ℤ) (N : σ → ℕ) (q : ι → ℕ) (r : ℕ) (δ : ℝ) (I : Finset ι) (x : ∀ i, σ → ZMod (q i)) : Prop := ∀ J : Finset ι, Disjoint I J → J.card ≤ r → ∀ y : ∀ i, σ → ZMod (q i), (∀ i ∈ I, y i = x i) → (primeCoordinateCell lo N q (I ∪ J) y).Nonempty → ‖primeCoordinateMean f lo N q I x - primeCoordinateMean f lo N q (I ∪ J) y‖ ≤ δ
theorem primeCoordinateStable_of_empty {ι σ : Type*} [DecidableEq ι] [Fintype σ] [DecidableEq σ] (f : (σ → ℤ) → ℂ) (lo : σ → ℤ) (N : σ → ℕ) (q : ι → ℕ) (r : ℕ) (δ : ℝ) (I : Finset ι) (x : ∀ i, σ → ZMod (q i)) (hempty : ¬ (primeCoordinateCell lo N q I x).Nonempty) : PrimeCoordinateStable f lo N q r δ I x := by intro J hIJ hJ y hxy hnonempty obtain ⟨z, hz⟩ := hnonempty exact False.elim (hempty ⟨z, primeCoordinateCell_mono lo N q Finset.subset_union_left hxy hz⟩)
universe u v
theorem exists_prime_cell_physical_comparison {ι : Type*} [DecidableEq ι] {σ : Type u} [Fintype σ] [DecidableEq σ] {s bound : ℕ} {gap : ℝ} (base : PhysicalEpochSource.{u, v} σ s bound) (T : base.model.Niltest (fun _ : σ => 1)) (horbit : T.orbit = base.fixedMap.orbit) (hpositive : T.UnitIntervalValued) (hcomplexity : T.ComplexityLE base.incomingBudget) (q : ι → ℕ) (hq : ∀ i, 0 < q i) (hcop : Pairwise (fun i j => (q i).Coprime (q j))) (I J : Finset ι) (hIJ : Disjoint I J) (x y : ∀ i, σ → ZMod (q i)) (hxy : ∀ i ∈ I, y i = x i) (u v : σ → ℤ) (hu : u ∈ primeCoordinateCell base.lower base.sides q I x) (hv : v ∈ primeCoordinateCell base.lower base.sides q (I ∪ J) y) (hgap : 0 < gap) (hgap1 : gap ≤ 1) (hinverse : gap⁻¹ ≤ Real.exp base.incomingBudget) (hrecord : 2 ≤ base.recordBudget) (hdiscrepancy : gap ≤ ‖primeCoordinateMean T.eval base.lower base.sides q I x - primeCoordinateMean T.eval base.lower base.sides q (I ∪ J) y‖) : ∃ c : PhysicalEpochComparison base (∏ i ∈ I, q i) 1 (∏ i ∈ J, q i) gap, c.Controlled ∧ c.anchor = u ∧ c.refined = v := by have hvmem := primeCoordinateCell_mono base.lower base.sides q Finset.subset_union_left hxy hv have hanchorCell := primeCoordinateCell_anchor base.lower base.sides q I x u hu have hcompat : ∀ i, v i ≡ u i [ZMOD ((∏ j ∈ I, q j : ℕ) : ℤ)] := by rw [hanchorCell] at hvmem exact ((mem_primeCoordinateCell_anchor base.lower base.sides q hcop I u v).mp hvmem).2 have huinside := (mem_translatedIntegerBox base.lower base.sides u).mp ((mem_primeCoordinateCell base.lower base.sides q I x u).mp hu).1 have hvinside := (mem_translatedIntegerBox base.lower base.sides v).mp ((mem_primeCoordinateCell base.lower base.sides q (I ∪ J) y v).mp hv).1 have hm : 0 < ∏ i ∈ I, q i := Finset.prod_pos (fun i _ => hq i) have hJ : 0 < ∏ i ∈ J, q i := Finset.prod_pos (fun i _ => hq i) have hphysical : gap ≤ ‖physicalResidueMean T.eval base.lower base.sides (∏ i ∈ I, q i) u - physicalResidueMean T.eval base.lower base.sides ((∏ i ∈ I, q i) * ∏ i ∈ J, q i) v‖ := by rw [primeCoordinateMean_eq_physical T.eval base.lower base.sides q hcop I x u hu, primeCoordinateMean_eq_physical T.eval base.lower base.sides q hcop (I ∪ J) y v hv, Finset.prod_union hIJ] at hdiscrepancy exact hdiscrepancy obtain ⟨c, hc, hcu, hcv, _, _⟩ := exists_initial_physical_comparison base T horbit hpositive hcomplexity hm hJ u v huinside hvinside hcompat hgap hgap1 hinverse hrecord hphysical exact ⟨c, hc, hcu, hcv⟩
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators
def primeCoordinateObservation {ι σ : Type*} (q : ι → ℕ) (z : σ → ℤ) : ∀ i, σ → ZMod (q i) := fun i j => (z j : ZMod (q i))
noncomputable def primeCoordinateReference {ι σ : Type*} [Fintype σ] [DecidableEq σ] (q : ι → ℕ) [∀ i, NeZero (q i)] : ∀ i, FiniteProbabilityWeights (σ → ZMod (q i)) := fun i => FiniteProbabilityWeights.uniform (σ → ZMod (q i))
theorem primeCoordinateReference_weight_pos {ι σ : Type*} [Fintype σ] [DecidableEq σ] (q : ι → ℕ) [∀ i, NeZero (q i)] (i : ι) (x : σ → ZMod (q i)) : 0 < (primeCoordinateReference (σ := σ) q i).weight x := by dsimp only [primeCoordinateReference, FiniteProbabilityWeights.uniform] positivity
noncomputable def primeCoordinateLaw {ι σ : Type*} [Fintype ι] [DecidableEq ι] [Fintype σ] [DecidableEq σ] (lo : σ → ℤ) (N : σ → ℕ) (hbox : (translatedIntegerBox lo N).Nonempty) (q : ι → ℕ) [∀ i, NeZero (q i)] : FiniteProbabilityWeights (∀ i, σ → ZMod (q i)) := (FiniteProbabilityWeights.uniformFinset (translatedIntegerBox lo N) hbox).fiberLaw (fun z => primeCoordinateObservation q z.val)
noncomputable def primeCoordinateDensity {ι σ : Type*} [Fintype ι] [DecidableEq ι] [Fintype σ] [DecidableEq σ] (lo : σ → ℤ) (N : σ → ℕ) (hbox : (translatedIntegerBox lo N).Nonempty) (q : ι → ℕ) [∀ i, NeZero (q i)] (f : (σ → ℤ) → ℝ) : (∀ i, σ → ZMod (q i)) → ℝ := observedProductDensity (primeCoordinateReference (σ := σ) q) (FiniteProbabilityWeights.uniformFinset (translatedIntegerBox lo N) hbox) (fun z => primeCoordinateObservation q z.val) (fun z => f z.val)
theorem primeCoordinateDensity_nonneg {ι σ : Type*} [Fintype ι] [DecidableEq ι] [Fintype σ] [DecidableEq σ] (lo : σ → ℤ) (N : σ → ℕ) (hbox : (translatedIntegerBox lo N).Nonempty) (q : ι → ℕ) [∀ i, NeZero (q i)] (f : (σ → ℤ) → ℝ) (hf : ∀ z ∈ translatedIntegerBox lo N, 0 ≤ f z) (x : ∀ i, σ → ZMod (q i)) : 0 ≤ primeCoordinateDensity lo N hbox q f x := by unfold primeCoordinateDensity observedProductDensity apply finiteWeightDensity_nonneg intro y apply FiniteProbabilityWeights.fiberMean_nonneg intro z exact hf z.val z.property
theorem primeCoordinateDensity_one {ι σ : Type*} [Fintype ι] [DecidableEq ι] [Fintype σ] [DecidableEq σ] (lo : σ → ℤ) (N : σ → ℕ) (hbox : (translatedIntegerBox lo N).Nonempty) (q : ι → ℕ) [∀ i, NeZero (q i)] (x : ∀ i, σ → ZMod (q i)) : primeCoordinateDensity lo N hbox q (fun _ => 1) x = (primeCoordinateLaw lo N hbox q).weight x / (FiniteProbabilityWeights.pi (primeCoordinateReference (σ := σ) q)).weight x := rfl
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators
abbrev ResiduePrimeCoordinateCell {ι σ : Type*} [DecidableEq ι] [Fintype σ] [DecidableEq σ] (lo : σ → ℤ) (N : σ → ℕ) (M : ℕ) (a : σ → ℤ) (q : ι → ℕ) (I : Finset ι) (x : ∀ i, σ → ZMod (q i)) := {z : IntegerResidueBox lo (fun j => lo j + N j) (fun _ => (M : ℤ)) a // ∀ i ∈ I, (fun j => ((z j).val : ZMod (q i))) = x i}
noncomputable def residuePrimeCoordinateMean {ι σ : Type*} [DecidableEq ι] [Fintype σ] [DecidableEq σ] (f : (σ → ℤ) → ℂ) (lo : σ → ℤ) (N : σ → ℕ) (M : ℕ) (a : σ → ℤ) (q : ι → ℕ) (I : Finset ι) (x : ∀ i, σ → ZMod (q i)) : ℂ := by classical exact 𝔼 z : ResiduePrimeCoordinateCell lo N M a q I x, f (fun j => (z.val j).val)
noncomputable def ResiduePrimeCoordinateStable {ι σ : Type*} [DecidableEq ι] [Fintype σ] [DecidableEq σ] (f : (σ → ℤ) → ℂ) (lo : σ → ℤ) (N : σ → ℕ) (M : ℕ) (a : σ → ℤ) (q : ι → ℕ) (r : ℕ) (δ : ℝ) (I : Finset ι) (x : ∀ i, σ → ZMod (q i)) : Prop := ∀ J : Finset ι, Disjoint I J → J.card ≤ r → ∀ y : ∀ i, σ → ZMod (q i), (∀ i ∈ I, y i = x i) → Nonempty (ResiduePrimeCoordinateCell lo N M a q (I ∪ J) y) → ‖residuePrimeCoordinateMean f lo N M a q I x - residuePrimeCoordinateMean f lo N M a q (I ∪ J) y‖ ≤ δ
noncomputable def primeCoordinateCell_subtypeEquiv {ι σ : Type*} [DecidableEq ι] [Fintype σ] [DecidableEq σ] (lo : σ → ℤ) (N : σ → ℕ) (q : ι → ℕ) (I : Finset ι) (x : ∀ i, σ → ZMod (q i)) : primeCoordinateCell lo N q I x ≃ {z : translatedIntegerBox lo N // ∀ i ∈ I, (fun j => (z.val j : ZMod (q i))) = x i} where toFun z := ⟨⟨z.val, ((mem_primeCoordinateCell lo N q I x z.val).mp z.property).1⟩, ((mem_primeCoordinateCell lo N q I x z.val).mp z.property).2⟩ invFun z := ⟨z.val.val, (mem_primeCoordinateCell lo N q I x z.val.val).mpr ⟨z.val.property, z.property⟩⟩ left_inv _ := rfl right_inv _ := rfl
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
def affineSampleAlphabetEquiv {J I R : Type*} : (Option J × I → R) ≃ (J → I → R) × (I → R) where toFun z := (fun j i => z (some j, i), fun i => z (none, i)) invFun z := baseArrayJoin (fun k => z.1 k.1 k.2) z.2 left_inv z := baseArrayJoin_eta z right_inv _ := rfl
theorem affineSampleAlphabet_weight {J I R : Type*} [Fintype J] [Fintype I] [Fintype R] [AddCommGroup R] (z : Option J × I → R) : (residueAffineSource (J := J) (G := I → R)).weight (affineSampleAlphabetEquiv z) = (FiniteProbabilityWeights.uniform (Option J × I → R)).weight z := by change (Fintype.card (J → I → R) : ℝ)⁻¹ * (Fintype.card (I → R) : ℝ)⁻¹ = (Fintype.card (Option J × I → R) : ℝ)⁻¹ rw [Fintype.card_congr (affineSampleAlphabetEquiv (J := J) (I := I) (R := R))] simp only [Fintype.card_prod, Nat.cast_mul, mul_inv_rev] ring
theorem affineSampleAlphabet_mean {J I R : Type*} [Fintype J] [Fintype I] [Fintype R] [AddCommGroup R] (f : ((J → I → R) × (I → R)) → ℝ) : (FiniteProbabilityWeights.uniform (Option J × I → R)).mean (fun z => f (affineSampleAlphabetEquiv z)) = (residueAffineSource (J := J) (G := I → R)).mean f := FiniteProbabilityWeights.mean_equiv _ _ affineSampleAlphabetEquiv affineSampleAlphabet_weight f
def affinePrimeCoordinateObservation {ι J I : Type*} (q : ι → ℕ) (z : Option J × I → ℤ) : ∀ i, (J → I → ZMod (q i)) × (I → ZMod (q i)) := fun i => affineSampleAlphabetEquiv (primeCoordinateObservation q z i)
theorem affinePrimeCoordinateObservation_apply {ι J I : Type*} (q : ι → ℕ) (z : Option J × I → ℤ) (i : ι) : affinePrimeCoordinateObservation q z i = (fun j k => (z (some j, k) : ZMod (q i)), fun k => (z (none, k) : ZMod (q i))) := rfl
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384import OAI.Combinatorics.Progressions.Estimates.PhysicalSingleSiteCommonCover
namespace OAI
section
namespace Erdos3.BooleanCubeKernel
open VectorPolynomial MeasureTheoryopen scoped BigOperators Classical
theorem exists_affine_site_cover_tilted_comparison (m r : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ {I K : Type*} [Fintype I] [DecidableEq I] [Fintype K] {J : Fin m → Type*} [∀ j, Fintype (J j)] {F : Type*} [Fintype F] {P : ℝ} (_hP : 0 ≤ P) (_hn : (Fintype.card I : ℝ) ≤ P) (_hd : (Fintype.card (Option K × I) : ℝ) ≤ P) (U : ∀ j, Submodule ℝ (J j → ℝ)) (root : K → ℤ) (difference : Fin r → K → ℤ) [MeasurableSpace (CoefficientTorus (K := K) U)] [BorelSpace (CoefficientTorus (K := K) U)] [MeasurableSpace (SiteTorus (Finset (Fin r)) U)] [BorelSpace (SiteTorus (Finset (Fin r)) U)] (μ : Measure (CoefficientTorus (K := K) U)) [μ.IsAddLeftInvariant] [IsProbabilityMeasure μ] {C : ℝ} (_hC : 0 ≤ C) (_hCP : C ≤ Real.exp P) (frequency : Bool → F → ∀ j, (K →₀ ℕ) → J j → ℤ) (_hbound : ∀ b a j d, d.degree ≤ j.val + 1 → ∀ t, |(frequency b a j d t : ℝ)| ≤ C) (c : Bool → F → ℂ) {B : ℝ} (_hB : 0 ≤ B) (_hBP : B ≤ Real.exp P) (_hcoefficients : ∀ b, (∑ a, ‖c b a‖) ≤ B) (p : ∀ j, VectorPolynomial I ℝ (J j → ℝ)) (_hp : ∀ j, DegreeLE (1 : I → ℕ) (j.val + 1) (p j)) (hm : ∀ j d, coefficients (p j) d ∈ U j) (q : ℕ) (_hq : 0 < q) (_hqP : (q : ℝ) ≤ Real.exp P) (stride : I → ℕ) (_hs : ∀ k, 0 < stride k) {R S ρ ε : ℝ} (_hS : 0 ≤ S) (_hSP : S ≤ Real.exp P) (_hρ : 0 < ρ) (_hε : 0 < ε) (_hρP : 1 / ρ ≤ Real.exp P) (_hεP : 1 / ε ≤ Real.exp P) (_hstride : ∀ k, (stride k : ℝ) ≤ S) (H : I → ℝ) (_hsize : ∀ k, Real.exp ((P + A) ^ A) ≤ H k) (_hrank : ∀ i, HasLayerSamplingRank (i.val + 1) H R (U i) (p i)) (_hR : Real.exp ((P + A) ^ A) ≤ R) (G : Finset (ColumnResiduePattern (Option K) I stride)) (_hG : G.Nonempty) (V : Option K × I → ℝ) (hV : ∀ z, 0 < V z) (_hwidth : ∀ z, ρ * H z.2 ≤ V z) (D : CoefficientTorus (K := K) U → ℝ) (_hD : Integrable D μ) (_hDmass : (∫ x, D x ∂μ) = 1) (_hD0 : ∀ x, 0 ≤ D x) (f : SiteTorus (Finset (Fin r)) U → ℂ) (_hf : Measurable f) (_hfbound : ∀ x, ‖f x‖ ≤ 1) {η : ℝ} (_hη : 0 ≤ η) (_happrox : ∀ b x, ‖(D x : ℂ) * (if b then f (coefficientSiteTorusMap U (fun s k => affineSite root difference s (some k)) x) else 1) - coefficientTorusFourierSum U (frequency b) (c b) x‖ ≤ η) (_hsmall : 2 * η + ε ≤ 1 / 2), ∃ hZ : 0 < ∑' x, selectedResidueSmoothWeight stride G V x, ∃ hDpos : 0 < selectedResidueDensityMass stride G V (fun z => D (affineCoefficientCoverSample U p hm q (fun k j => (z (k, j) : ℝ)))), |selectedResidueDensityMass stride G V (fun z => D (affineCoefficientCoverSample U p hm q (fun k j => (z (k, j) : ℝ)))) - 1| ≤ 2 * η + ε ∧ (1 / 2 ≤ selectedResidueDensityMass stride G V (fun z => D (affineCoefficientCoverSample U p hm q (fun k j => (z (k, j) : ℝ))))) ∧ (selectedResidueDensityMass stride G V (fun z => D (affineCoefficientCoverSample U p hm q (fun k j => (z (k, j) : ℝ)))) ≤ 3 / 2) ∧ ‖(∑' z, ((selectedResidueDensityPMF stride G V hV hZ (fun z => D (affineCoefficientCoverSample U p hm q (fun k j => (z (k, j) : ℝ)))) (fun _z => _hD0 _) hDpos z).toReal : ℂ) * f (affineCoveredSiteSample U root difference q p hm (fun k j => (z (k, j) : ℝ)))) - (∫ x, (D x : ℂ) * f (coefficientSiteTorusMap U (fun s k => affineSite root difference s (some k)) x) ∂μ)‖ ≤ 4 * (2 * η + ε) := by obtain ⟨A, hA, hcomparison⟩ := exists_affine_coefficient_cover_tilted_comparison m refine ⟨A, hA, ?_⟩ intro I K _ _ _ J _ F _ P hP hn hd U root difference _ _ _ _ μ _ _ C hC hCP frequency hbound c B hB hBP hcoefficients p hp hm q hq hqP stride hs R S ρ ε hS hSP hρ hε hρP hεP hstride H hsize hrank hR G hG V hV hwidth D hD hDmass hD0 f hf hfbound η hη happrox hsmall let g : CoefficientTorus (K := K) U → ℂ := fun x => f (coefficientSiteTorusMap U (fun s k => affineSite root difference s (some k)) x) have hg : AEStronglyMeasurable g μ := (hf.comp (coefficientSiteTorusMap_continuous U _).measurable).aestronglyMeasurable obtain ⟨hZ, hDpos, hmass, hlower, hupper, he⟩ := hcomparison hP hn hd U μ hC hCP frequency hbound c hB hBP hcoefficients p hp hm q hq hqP stride hs hS hSP hρ hε hρP hεP hstride H hsize hrank hR G hG V hV hwidth D hD hDmass hD0 g hg (fun _ => hfbound _) hη happrox hsmall refine ⟨hZ, hDpos, hmass, hlower, hupper, ?_⟩ simpa only [g, coefficientSiteTorusMap_coverSample U root difference q p hp hm] using he
end Erdos3.BooleanCubeKernel
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132import Mathlib.Analysis.Calculus.ContDiff.Operationsimport Mathlib.Analysis.Calculus.FDeriv.CompCLMimport Mathlib.Tactic
namespace OAI
section
namespace Erdos3
variable {E X Y : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup X] [NormedSpace ℝ X] [NormedAddCommGroup Y] [NormedSpace ℝ Y]
noncomputable def operatorPrecompose (J : E →L[ℝ] X) : (X →L[ℝ] Y) →L[ℝ] (E →L[ℝ] Y) := (ContinuousLinearMap.compL ℝ E X Y).flip J
theorem operatorPrecompose_apply (J : E →L[ℝ] X) (A : X →L[ℝ] Y) : operatorPrecompose J A = A.comp J := rfl
theorem operatorPrecompose_norm_le (J : E →L[ℝ] X) : ‖operatorPrecompose (Y := Y) J‖ ≤ ‖J‖ := by apply ContinuousLinearMap.opNorm_le_bound _ (norm_nonneg J) intro A exact (A.opNorm_comp_le J).trans_eq (mul_comm _ _)
theorem affineSlice_fderiv (F : X → Y) (c : X) (J : E →L[ℝ] X) (x : E) (hF : DifferentiableAt ℝ F (c + J x)) : fderiv ℝ (fun y => F (c + J y)) x = (fderiv ℝ F (c + J x)).comp J := by exact (hF.hasFDerivAt.comp x (J.hasFDerivAt.const_add c)).fderiv
theorem affineSlice_fderiv_norm_le (F : X → Y) (c : X) (J : E →L[ℝ] X) (x : E) (hF : DifferentiableAt ℝ F (c + J x)) (hJ : ‖J‖ ≤ 1) {H : ℝ} (hH : ‖fderiv ℝ F (c + J x)‖ ≤ H) : ‖fderiv ℝ (fun y => F (c + J y)) x‖ ≤ H := by rw [affineSlice_fderiv F c J x hF] calc _ ≤ ‖fderiv ℝ F (c + J x)‖ * ‖J‖ := ContinuousLinearMap.opNorm_comp_le _ _ _ ≤ H * 1 := mul_le_mul hH hJ (norm_nonneg J) ((norm_nonneg _).trans hH) _ = H := mul_one H
theorem affineSlice_second_fderiv_norm_le (F : X → Y) (hF : ContDiff ℝ 2 F) (c : X) (J : E →L[ℝ] X) (x : E) (hJ : ‖J‖ ≤ 1) {H : ℝ} (hH : ‖fderiv ℝ (fderiv ℝ F) (c + J x)‖ ≤ H) : ‖fderiv ℝ (fderiv ℝ (fun y => F (c + J y))) x‖ ≤ H := by let L : (X →L[ℝ] Y) →L[ℝ] (E →L[ℝ] Y) := operatorPrecompose J let g : E → (X →L[ℝ] Y) := fun y => fderiv ℝ F (c + J y) have hD : ContDiff ℝ 1 (fderiv ℝ F) := hF.fderiv_right (by norm_num) have hg := ((hD.differentiable one_ne_zero (c + J x)).hasFDerivAt.comp x (J.hasFDerivAt.const_add c)) have hg' : HasFDerivAt g ((fderiv ℝ (fderiv ℝ F) (c + J x)).comp J) x := hg have he : fderiv ℝ (fun y => F (c + J y)) = L ∘ g := by funext y exact affineSlice_fderiv F c J y (hF.differentiable (by norm_num) _) rw [he, fderiv_comp x L.differentiableAt hg'.differentiableAt, L.fderiv, hg'.fderiv] have hL : ‖L‖ ≤ 1 := (operatorPrecompose_norm_le J).trans hJ have hinner : ‖(fderiv ℝ (fderiv ℝ F) (c + J x)).comp J‖ ≤ H := by calc _ ≤ ‖fderiv ℝ (fderiv ℝ F) (c + J x)‖ * ‖J‖ := ContinuousLinearMap.opNorm_comp_le _ _ _ ≤ H * 1 := mul_le_mul hH hJ (norm_nonneg J) ((norm_nonneg (fderiv ℝ (fderiv ℝ F) (c + J x))).trans hH) _ = H := mul_one H calc _ ≤ ‖L‖ * ‖(fderiv ℝ (fderiv ℝ F) (c + J x)).comp J‖ := ContinuousLinearMap.opNorm_comp_le _ _ _ ≤ 1 * H := mul_le_mul hL hinner (norm_nonneg ((fderiv ℝ (fderiv ℝ F) (c + J x)).comp J)) zero_le_one _ = H := one_mul H
end Erdos3
end
section
namespace Erdos3
variable {E X Y : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E] [NormedAddCommGroup X] [NormedSpace ℝ X] [NormedAddCommGroup Y] [NormedSpace ℝ Y]
theorem second_fderiv_sub (F G : X → Y) (hF : ContDiff ℝ 2 F) (hG : ContDiff ℝ 2 G) (x : X) : fderiv ℝ (fderiv ℝ (fun y => F y - G y)) x = fderiv ℝ (fderiv ℝ F) x - fderiv ℝ (fderiv ℝ G) x := by have he : fderiv ℝ (fun y => F y - G y) = fun y => fderiv ℝ F y - fderiv ℝ G y := by funext y exact fderiv_sub (hF.differentiable (by norm_num) y) (hG.differentiable (by norm_num) y) rw [he] exact fderiv_sub ((hF.fderiv_right (by norm_num : 1 + 1 ≤ (2 : WithTop ℕ∞))).differentiable one_ne_zero x) ((hG.fderiv_right (by norm_num : 1 + 1 ≤ (2 : WithTop ℕ∞))).differentiable one_ne_zero x)
theorem affineSlice_first_difference_bound (F G : X → Y) (hF : ContDiff ℝ 2 F) (hG : ContDiff ℝ 2 G) (b : X) (J : E →L[ℝ] X) (hJ : ‖J‖ ≤ 1) (x : E) {ε : ℝ} (herr : ‖fderiv ℝ F (b + J x) - fderiv ℝ G (b + J x)‖ ≤ ε) : ‖fderiv ℝ (fun y => F (b + J y)) x - fderiv ℝ (fun y => G (b + J y)) x‖ ≤ ε := by rw [affineSlice_fderiv F b J x (hF.differentiable (by norm_num) _), affineSlice_fderiv G b J x (hG.differentiable (by norm_num) _), ← ContinuousLinearMap.sub_comp] exact ((ContinuousLinearMap.opNorm_comp_le _ _).trans (mul_le_of_le_one_right (norm_nonneg _) hJ)).trans herr
theorem affineSlice_second_difference_bound (F G : X → Y) (hF : ContDiff ℝ 2 F) (hG : ContDiff ℝ 2 G) (b : X) (J : E →L[ℝ] X) (hJ : ‖J‖ ≤ 1) (x : E) {ε : ℝ} (herr : ‖fderiv ℝ (fderiv ℝ F) (b + J x) - fderiv ℝ (fderiv ℝ G) (b + J x)‖ ≤ ε) : ‖fderiv ℝ (fderiv ℝ (fun y => F (b + J y))) x - fderiv ℝ (fderiv ℝ (fun y => G (b + J y))) x‖ ≤ ε := by have hs : ‖fderiv ℝ (fderiv ℝ (fun y => F y - G y)) (b + J x)‖ ≤ ε := by rw [second_fderiv_sub F G hF hG] exact herr have ht := affineSlice_second_fderiv_norm_le (fun y => F y - G y) (hF.sub hG) b J x hJ hs have hFs : ContDiff ℝ 2 (fun y => F (b + J y)) := hF.comp (contDiff_const.add J.contDiff) have hGs : ContDiff ℝ 2 (fun y => G (b + J y)) := hG.comp (contDiff_const.add J.contDiff) rw [second_fderiv_sub (fun y => F (b + J y)) (fun y => G (b + J y)) hFs hGs] at ht exact ht
theorem affineSlice_c2_difference_bound (F G : X → Y) (hF : ContDiff ℝ 2 F) (hG : ContDiff ℝ 2 G) (b : X) (J : E →L[ℝ] X) (hJ : ‖J‖ ≤ 1) (x : E) {ε : ℝ} (herr : ‖F (b + J x) - G (b + J x)‖ ≤ ε ∧ ‖fderiv ℝ F (b + J x) - fderiv ℝ G (b + J x)‖ ≤ ε ∧ ‖fderiv ℝ (fderiv ℝ F) (b + J x) - fderiv ℝ (fderiv ℝ G) (b + J x)‖ ≤ ε) : ‖F (b + J x) - G (b + J x)‖ ≤ ε ∧ ‖fderiv ℝ (fun y => F (b + J y)) x - fderiv ℝ (fun y => G (b + J y)) x‖ ≤ ε ∧ ‖fderiv ℝ (fderiv ℝ (fun y => F (b + J y))) x - fderiv ℝ (fderiv ℝ (fun y => G (b + J y))) x‖ ≤ ε := ⟨herr.1, affineSlice_first_difference_bound F G hF hG b J hJ x herr.2.1, affineSlice_second_difference_bound F G hF hG b J hJ x herr.2.2⟩
end Erdos3
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859import OAI.Combinatorics.Progressions.Estimates.SlicedSourceAccuracy
namespace OAI
section
namespace Erdos3open scoped BigOperators NNReal
theorem affineSourceAccuracy_budget {ι κ : Type*} [Fintype ι] [Fintype κ] {Dout Dgrid Prho Pbox Op E F C : ℝ} (hDout : 0 ≤ Dout) (hDgrid : 0 ≤ Dgrid) (hPrho : 0 ≤ Prho) (hPbox : 0 ≤ Pbox) (hE : 0 ≤ E) (hF : 0 ≤ F) (hout : (Fintype.card κ : ℝ) ≤ Dout) (hgrid : (Fintype.card ι : ℝ) ≤ Dgrid) (ρ : ℝ≥0) (hρ : (ρ : ℝ)⁻¹ ≤ Real.exp Prho) (hC0 : 0 ≤ C) (hC : C ≤ Real.exp F) : let G := Dgrid * max Op 0 let εgrid := Real.exp (-(Dout * Prho + (E + F) + 1)) let εlong := Real.exp (-(G + (E + F) + 1)) let Plong := Pbox + Prho + G + (E + F) + 2 0 < εgrid ∧ εgrid ≤ 1 ∧ εgrid⁻¹ = Real.exp (Dout * Prho + (E + F) + 1) ∧ 0 < εlong ∧ εlong ≤ 1 ∧ εlong⁻¹ ≤ Real.exp Plong ∧ 0 ≤ Plong ∧ Pbox ≤ Plong ∧ (ρ : ℝ)⁻¹ ≤ Real.exp Plong ∧ C * ((ρ⁻¹ ^ Fintype.card κ : ℝ≥0) * εgrid + εlong * ∏ _i : ι, Real.exp Op) ≤ Real.exp (-E) := by intro G εgrid εlong Plong have hG : 0 ≤ G := mul_nonneg hDgrid (le_max_right _ _) obtain ⟨hg0, hg1, hgi, hl0, hl1, hli, herr⟩ := slicedSourceAccuracy_bounds (mul_nonneg hDout hPrho) hG (add_nonneg hE hF) have hPlong : G + (E + F) + 1 ≤ Plong := by dsimp [Plong]; linarith have hb : Pbox ≤ Plong := by dsimp [Plong]; linarith have hr : Prho ≤ Plong := by dsimp [Plong]; linarith have hcap : (ρ⁻¹ ^ Fintype.card κ : ℝ≥0) ≤ Real.exp (Dout * Prho) := by rw [NNReal.coe_pow, NNReal.coe_inv] calc _ ≤ (Real.exp Prho) ^ Fintype.card κ := pow_le_pow_left₀ (inv_nonneg.mpr ρ.coe_nonneg) hρ _ _ = Real.exp (Fintype.card κ * Prho) := (Real.exp_nat_mul _ _).symm _ ≤ _ := Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_right hout hPrho) have hprod : (∏ _i : ι, Real.exp Op) ≤ Real.exp G := by simp only [Finset.prod_const, Finset.card_univ, ← Real.exp_nat_mul] apply Real.exp_le_exp.mpr exact (mul_le_mul_of_nonneg_left (le_max_left _ _) (Nat.cast_nonneg _)).trans (mul_le_mul_of_nonneg_right hgrid (le_max_right _ _)) refine ⟨hg0, hg1, hgi, hl0, hl1, hli.trans_le (Real.exp_le_exp.mpr hPlong), hPbox.trans hb, hb, hρ.trans (Real.exp_le_exp.mpr hr), ?_⟩ calc _ ≤ C * (Real.exp (Dout * Prho) * εgrid + εlong * ∏ _i : ι, Real.exp Op) := by apply mul_le_mul_of_nonneg_left _ hC0 exact add_le_add (mul_le_mul_of_nonneg_right hcap hg0.le) le_rfl _ ≤ C * Real.exp (-(E + F)) := mul_le_mul_of_nonneg_left (herr _ hprod) hC0 _ ≤ Real.exp F * Real.exp (-(E + F)) := mul_le_mul_of_nonneg_right hC (Real.exp_nonneg _) _ = _ := by rw [← Real.exp_add]; congr 1; ring
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142import OAI.Combinatorics.Progressions.Sampling.SquareSamplingAccuracy
namespace OAI
section
namespace Erdos3
noncomputable def affineSquareErrorAccuracy (target capLog : ℝ) : ℝ := Real.exp (-(target + capLog + 24))
theorem affineSquareErrorAccuracy_pos (target capLog : ℝ) : 0 < affineSquareErrorAccuracy target capLog := Real.exp_pos _
theorem affineSquareErrorAccuracy_inv (target capLog : ℝ) : (affineSquareErrorAccuracy target capLog)⁻¹ = Real.exp (target + capLog + 24) := by rw [affineSquareErrorAccuracy, ← Real.exp_neg, neg_neg]
theorem affineSquareErrorAccuracy_bound {target capLog cap e₁ e₂ e₃ : ℝ} (hcap0 : 0 ≤ cap) (hcap : cap ≤ Real.exp capLog) (h₁ : e₁ ≤ affineSquareErrorAccuracy target capLog) (h₂ : e₂ ≤ affineSquareErrorAccuracy target capLog) (h₃ : e₃ ≤ affineSquareErrorAccuracy target capLog) : cap * (e₁ + e₂ + e₃) ≤ Real.exp (-(target + 20)) := by have hb := (affineSquareErrorAccuracy_pos target capLog).le have he : e₁ + e₂ + e₃ ≤ 3 * affineSquareErrorAccuracy target capLog := by linarith only [h₁, h₂, h₃] have h3 : (3 : ℝ) ≤ Real.exp 4 := by linarith [Real.add_one_le_exp (4 : ℝ)] calc _ ≤ cap * (3 * affineSquareErrorAccuracy target capLog) := mul_le_mul_of_nonneg_left he hcap0 _ ≤ Real.exp capLog * (Real.exp 4 * affineSquareErrorAccuracy target capLog) := by gcongr _ = _ := by unfold affineSquareErrorAccuracy rw [← Real.exp_add, ← Real.exp_add] congr 1 ring
end Erdos3
end
end OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697import OAI.Combinatorics.Progressions.Geometry.TopSupportSubstitutionimport OAI.Combinatorics.Progressions.Polynomial.AffineShiftPolynomial
namespace OAI
section
namespace Erdos3
open MvPolynomialopen scoped BigOperators Classical
theorem affineShiftPullback_translate {I : Type*} {n : ℕ} (base : I → ℝ) (direction : Fin n → I → ℝ) (P : MvPolynomial I ℝ) : affineShiftPullback (fun _ => 0) direction (polynomialTranslate base P) = affineShiftPullback base direction P := by have he : (affineShiftPullback (fun _ => 0) direction).comp (polynomialTranslate base) = affineShiftPullback base direction := by apply algHom_ext intro i simp [AlgHom.comp_apply, polynomialTranslate_X, affineShiftPullback, affineShiftCoordinate, add_comm] exact AlgHom.congr_fun he P
theorem affineShift_full_coefficient_base {I : Type*} {n : ℕ} (base : I → ℝ) (direction : Fin n → I → ℝ) (P : MvPolynomial I ℝ) (hP : P.totalDegree ≤ n) : (affineShiftPullback base direction P).coeff (fullShiftExponent n) = (affineShiftPullback (fun _ => 0) direction P).coeff (fullShiftExponent n) := by have hc (i : I) : affineShiftCoordinate (fun _ => 0) direction i ∈ weightedSupportLE (1 : Fin n → ℕ) ((1 : I → ℕ) i) := (mem_weightedSupportLE_one_iff _ 1).mpr (affineShiftCoordinate_degree _ _ _) have hp := (mem_weightedSupportLE_one_iff P n).mpr hP have ht := polynomialTranslate_sub_mem_weightedSupportLT base (1 : I → ℕ) (fun _ => by simp) hp have hl := weightedSupportLT_aeval (1 : I → ℕ) (1 : Fin n → ℕ) (affineShiftCoordinate (fun _ => 0) direction) hc ht have hz := full_coefficient_zero_of_lower_support hl change (affineShiftPullback (fun _ => 0) direction (polynomialTranslate base P - P)).coeff (fullShiftExponent n) = 0 at hz rw [map_sub, coeff_sub, affineShiftPullback_translate] at hz exact sub_eq_zero.mp hz
theorem sub_topComponent_mem_lowerSupport {I R : Type*} [CommRing R] {n : ℕ} (P : MvPolynomial I R) (hP : P.totalDegree ≤ n) : P - homogeneousComponent n P ∈ weightedSupportLT (1 : I → ℕ) n := by intro a ha change Finsupp.weight (1 : I → ℕ) a < n have hne : (P - homogeneousComponent n P).coeff a ≠ 0 := mem_support_iff.mp ha simp only [coeff_sub, coeff_homogeneousComponent] at hne by_cases hd : a.degree = n · simp only [hd, ite_true, sub_self, ne_eq, not_true_eq_false] at hne · have haP : P.coeff a ≠ 0 := by intro hz simp only [hz, hd, ite_false, sub_self, ne_eq, not_true_eq_false] at hne have hle : Finsupp.weight (1 : I → ℕ) a ≤ n := (mem_weightedSupportLE_one_iff P n).mpr hP (mem_support_iff.mpr haP) have hn : Finsupp.weight (1 : I → ℕ) a ≠ n := by simpa only [Finsupp.degree_eq_weight_one, Pi.one_def] using hd omega
theorem affineShift_full_coefficient_top {I : Type*} {n : ℕ} (base : I → ℝ) (direction : Fin n → I → ℝ) (P : MvPolynomial I ℝ) (hP : P.totalDegree ≤ n) : (affineShiftPullback base direction P).coeff (fullShiftExponent n) = (affineShiftPullback base direction (homogeneousComponent n P)).coeff (fullShiftExponent n) := by have hc (i : I) : affineShiftCoordinate base direction i ∈ weightedSupportLE (1 : Fin n → ℕ) ((1 : I → ℕ) i) := (mem_weightedSupportLE_one_iff _ 1).mpr (affineShiftCoordinate_degree _ _ _) have hl := weightedSupportLT_aeval (1 : I → ℕ) (1 : Fin n → ℕ) (affineShiftCoordinate base direction) hc (sub_topComponent_mem_lowerSupport P hP) have hz := full_coefficient_zero_of_lower_support hl change (affineShiftPullback base direction (P - homogeneousComponent n P)).coeff (fullShiftExponent n) = 0 at hz rw [map_sub, coeff_sub] at hz exact sub_eq_zero.mp hz
noncomputable def polynomialTopSymbol {I : Type*} (n : ℕ) (P : MvPolynomial I ℝ) (direction : Fin n → I → ℝ) : ℝ := (affineShiftPullback (fun _ => 0) direction (homogeneousComponent n P)).coeff (fullShiftExponent n)
theorem affineShift_difference_eq_topSymbol {I : Type*} {n : ℕ} (base : I → ℝ) (direction : Fin n → I → ℝ) (P : MvPolynomial I ℝ) (hP : P.totalDegree ≤ n) (u v : Fin n → ℝ) : additiveBoxDifference n (fun t (_ : Unit) => eval (fun i => base i + ∑ j, direction j i * t j) P) u v () = polynomialTopSymbol n P direction * ∏ i, (u i - v i) := by rw [affineShift_full_difference base direction P hP, affineShift_full_coefficient_base base direction P hP, affineShift_full_coefficient_top (fun _ => 0) direction P hP] rfl
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316import OAI.Combinatorics.Progressions.Estimates.CubeTranslationimport OAI.Combinatorics.Progressions.Estimates.ScalarCubeRootTranslationimport OAI.Combinatorics.Progressions.Linear.WindowGoodKernelBound
namespace OAI
section
namespace Erdos3
open scoped BigOperators
def integerStrideHom (m : ℤ) : ℤ →+ ℤ where toFun x := m * x map_zero' := mul_zero m map_add' := mul_add m
theorem integerStride_reflectsPairSums (m : ℤ) (hm : m ≠ 0) (Q : Set ℤ) : ReflectsPairSums (integerStrideHom m) Q := by intro a _ b _ c _ d _ h apply mul_left_cancel₀ hm simpa only [integerStrideHom, AddMonoidHom.coe_mk, ZeroHom.coe_mk, mul_add] using h
noncomputable def integerProgressionSupport (c m : ℤ) (L : ℕ) : Finset ℤ := translateSupport c ((Finset.Ico (0 : ℤ) (L : ℤ)).image (integerStrideHom m))
noncomputable def supportedIntervalProgressionEquiv (q L : ℕ) (c m : ℤ) (hm : m ≠ 0) : SupportedCube q (Set.Ico (0 : ℤ) (L : ℤ)) ≃ SupportedCube q (integerProgressionSupport c m L : Set ℤ) := by let e := supportedCubeEquiv (integerStride_reflectsPairSums m hm (Set.Ico 0 (L : ℤ))) q let e' : SupportedCube q (integerStrideHom m '' Set.Ico (0 : ℤ) (L : ℤ)) ≃ SupportedCube q (((Finset.Ico (0 : ℤ) (L : ℤ)).image (integerStrideHom m)) : Set ℤ) := Equiv.subtypeEquivRight (fun p => by simp only [Finset.coe_image, Finset.coe_Ico]) exact (e.trans e').trans (supportedCubeTranslateEquiv q _ c)
theorem supportedIntervalProgressionEquiv_value (q L : ℕ) (c m : ℤ) (hm : m ≠ 0) (p : SupportedCube q (Set.Ico (0 : ℤ) (L : ℤ))) : (supportedIntervalProgressionEquiv q L c m hm p).val = (fun i => m * p.val.1 i, c + m * p.val.2) := rfl
theorem integerScalarCubeWeights_progression_mean (q L : ℕ) (hL : 0 < L) (c m : ℤ) (hm : m ≠ 0) (f : ((Fin q → ℤ) × ℤ) → ℝ) : (integerScalarCubeWeights (Fin q) L hL).mean (fun x => f (fun i => m * (x (some i) : ℤ), c + m * (x none : ℤ))) = 𝔼 p : SupportedCube q (integerProgressionSupport c m L : Set ℤ), f p.val := by calc _ = 𝔼 p : SupportedCube q (Set.Ico (0 : ℤ) (L : ℤ)), f (fun i => m * p.val.1 i, c + m * p.val.2) := integerScalarCubeWeights_supported_mean q L hL (fun p => f (fun i => m * p.1 i, c + m * p.2)) _ = _ := Fintype.expect_equiv (supportedIntervalProgressionEquiv q L c m hm) _ _ (fun _ => rfl)
end Erdos3
end
section
namespace Erdos3
abbrev TranslatedResidueSupportedCube (q K : ℕ) (c : ℤ) (m : Option (Fin q) → ℕ) (r : ∀ i, ZMod (m i)) := {p : SupportedCube q (Set.Ico c (c + K)) // ∀ i, ((supportedCubeCoordinates p.val i : ℤ) : ZMod (m i)) = r i}
noncomputable def shiftedScalarCubeResidueEquiv (q K : ℕ) (c : ℤ) (m : Option (Fin q) → ℕ) (r : ∀ i, ZMod (m i)) : ↥((integerScalarCubeSet (Fin q) K) ∩ scalarCubeResidueSet (Fin q) K m (shiftScalarCubeResidues c m r)) ≃ TranslatedResidueSupportedCube q K c m r := by let e := shiftedScalarCubeEquiv q K c refine { toFun := fun x => ⟨e ⟨x.val, (Finset.mem_inter.mp x.property).1⟩, ?_⟩ invFun := fun y => ⟨(e.symm y.val).val, ?_⟩ left_inv := ?_ right_inv := ?_ } · change ∀ i, ((supportedCubeCoordinates (shiftedScalarCubeEquiv q K c ⟨x.val, (Finset.mem_inter.mp x.property).1⟩).val i : ℤ) : ZMod (m i)) = r i rw [shiftedScalarCubeEquiv_coordinates] exact (shiftScalarCube_residues_iff c m r _).mpr ((mem_scalarCubeResidueSet K m (shiftScalarCubeResidues c m r) x.val).mp (Finset.mem_inter.mp x.property).2) · refine Finset.mem_inter.mpr ⟨(e.symm y.val).property, ?_⟩ apply (mem_scalarCubeResidueSet K m (shiftScalarCubeResidues c m r) _).mpr apply (shiftScalarCube_residues_iff c m r _).mp rw [← shiftedScalarCubeEquiv_coordinates] simpa only [e, Equiv.apply_symm_apply] using y.property · intro x apply Subtype.ext change (e.symm (e ⟨x.val, (Finset.mem_inter.mp x.property).1⟩)).val = x.val rw [e.symm_apply_apply] · intro y apply Subtype.ext change e (e.symm y.val) = y.val exact e.apply_symm_apply y.val
theorem shiftedScalarCubeResidueEquiv_coordinates (q K : ℕ) (c : ℤ) (m : Option (Fin q) → ℕ) (r : ∀ i, ZMod (m i)) (x : ↥((integerScalarCubeSet (Fin q) K) ∩ scalarCubeResidueSet (Fin q) K m (shiftScalarCubeResidues c m r))) : supportedCubeCoordinates (shiftedScalarCubeResidueEquiv q K c m r x).val.val = shiftScalarCube c (fun i => (x.val i : ℤ)) := by funext i cases i <;> rfl
end Erdos3
end
section
namespace Erdos3
theorem mem_integerProgressionSupport_iff (c : ℤ) (m H : ℕ) (hm : 0 < m) (x : ℤ) : x ∈ integerProgressionSupport c (m : ℤ) H ↔ c ≤ x ∧ x < c + (m * H : ℕ) ∧ (x : ZMod m) = (c : ZMod m) := by have hm' : (0 : ℤ) < m := by exact_mod_cast hm rw [integerProgressionSupport, mem_translateSupport, Finset.mem_image] constructor · rintro ⟨y, hy, he⟩ have hy' := Finset.mem_Ico.mp hy change (m : ℤ) * y = x - c at he have hx : x = c + (m : ℤ) * y := by omega constructor · nlinarith constructor · push_cast nlinarith · rw [hx] simp · rintro ⟨hlo, hhi, hr⟩ have hz : ((x - c : ℤ) : ZMod m) = 0 := by simp [hr] obtain ⟨y, hy⟩ := (ZMod.intCast_zmod_eq_zero_iff_dvd (x - c) m).mp hz have hy0 : 0 ≤ y := by nlinarith have hyH : y < H := by push_cast at hhi; nlinarith exact ⟨y, Finset.mem_Ico.mpr ⟨hy0, hyH⟩, hy.symm⟩
def progressionCubeResidues (q m : ℕ) (c : ℤ) : Option (Fin q) → ZMod m | none => (c : ZMod m) | some _ => 0
noncomputable def progressionResidueSupportedCubeEquiv (q m H : ℕ) (c : ℤ) (hm : 0 < m) : SupportedCube q (integerProgressionSupport c (m : ℤ) H : Set ℤ) ≃ TranslatedResidueSupportedCube q (m * H) c (fun _ => m) (progressionCubeResidues q m c) where toFun p := by let p' : SupportedCube q (Set.Ico c (c + (m * H : ℕ))) := ⟨p.val, fun ω => by have h := (mem_integerProgressionSupport_iff c m H hm _).mp (p.property ω) exact ⟨h.1, h.2.1⟩⟩ refine ⟨p', ?_⟩ intro i cases i with | none => exact ((mem_integerProgressionSupport_iff c m H hm _).mp p.base_mem).2.2 | some i => have h0 := ((mem_integerProgressionSupport_iff c m H hm _).mp p.base_mem).2.2 have hi := ((mem_integerProgressionSupport_iff c m H hm _).mp (p.axis_mem i)).2.2 change (p.val.1 i : ZMod m) = 0 push_cast at hi rw [h0] at hi exact add_left_cancel (hi.trans (add_zero _).symm) invFun p := by refine ⟨p.val.val, fun ω => ?_⟩ apply (mem_integerProgressionSupport_iff c m H hm _).mpr have h := p.val.property ω refine ⟨h.1, h.2, ?_⟩ have h0 : (p.val.val.2 : ZMod m) = (c : ZMod m) := p.property none have hi (i : Fin q) : (p.val.val.1 i : ZMod m) = 0 := p.property (some i) simp only [Int.cast_add, h0, cubeShift, Int.cast_sum, apply_ite, hi, Int.cast_zero, ite_self, Finset.sum_const_zero, add_zero] left_inv p := by apply Subtype.ext; rfl right_inv p := by apply Subtype.ext; apply Subtype.ext; rfl
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators
noncomputable def affineScalarCubeWindowWeights (I : Type*) [Fintype I] [DecidableEq I] (L K M D : ℕ) (c : ℤ) (hL : 0 < L) (hKL : K ≤ L) (hDK : L ≤ D * K) (m : Option I → ℕ) (r : ∀ i, ZMod (m i)) (hm : ∀ i, 0 < m i) (hmM : ∀ i, m i ≤ M) (hsize : (Fintype.card I + 1) * M ≤ K) : FiniteProbabilityWeights (IntegerScalarCubeBox I L) := scalarCubeWindowWeights I L K M D hL hKL hDK m (shiftScalarCubeResidues c m r) hm hmM hsize
theorem affineScalarCubeWindowWeights_supported_mean (q L K M D : ℕ) (c : ℤ) (hL : 0 < L) (hKL : K ≤ L) (hDK : L ≤ D * K) (m : Option (Fin q) → ℕ) (r : ∀ i, ZMod (m i)) (hm : ∀ i, 0 < m i) (hmM : ∀ i, m i ≤ M) (hsize : (Fintype.card (Fin q) + 1) * M ≤ K) (f : (Option (Fin q) → ℤ) → ℝ) : (affineScalarCubeWindowWeights (Fin q) L K M D c hL hKL hDK m r hm hmM hsize).mean (fun x => f (shiftScalarCube c (fun i => (x i : ℤ)))) = 𝔼 p : TranslatedResidueSupportedCube q K c m r, f (supportedCubeCoordinates p.val.val) := by classical have hM : 0 < M := (hm none).trans_le (hmM none) have hK : 0 < K := (Nat.mul_pos (Nat.succ_pos _) hM).trans_le hsize unfold affineScalarCubeWindowWeights rw [scalarCubeWindowWeights_small_mean (Fin q) L K M D hL hK hKL hDK, scalarCubeResidueWeights_mean] apply Fintype.expect_equiv (shiftedScalarCubeResidueEquiv q K c m r) intro x rw [shiftedScalarCubeResidueEquiv_coordinates] rfl
theorem affineScalarCubeWindowWeights_weight_le (I : Type*) [Fintype I] [DecidableEq I] (L K M D : ℕ) (c : ℤ) (hL : 0 < L) (hKL : K ≤ L) (hDK : L ≤ D * K) (m : Option I → ℕ) (r : ∀ i, ZMod (m i)) (hm : ∀ i, 0 < m i) (hmM : ∀ i, m i ≤ M) (hsize : (Fintype.card I + 1) * M ≤ K) (x : IntegerScalarCubeBox I L) : (affineScalarCubeWindowWeights I L K M D c hL hKL hDK m r hm hmM hsize).weight x ≤ scalarCubeResidueDensityCap I (M * D) * (integerScalarCubeWeights I L hL).weight x := scalarCubeWindowWeights_weight_le I L K M D hL hKL hDK m (shiftScalarCubeResidues c m r) hm hmM hsize x
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators
theorem affineScalarCubeWindowWeights_progression_mean (q L m H M D : ℕ) (c : ℤ) (hL : 0 < L) (hm : 0 < m) (hmM : m ≤ M) (hKL : m * H ≤ L) (hDK : L ≤ D * (m * H)) (hsize : (Fintype.card (Fin q) + 1) * M ≤ m * H) (f : (Option (Fin q) → ℤ) → ℝ) : (affineScalarCubeWindowWeights (Fin q) L (m * H) M D c hL hKL hDK (fun _ => m) (progressionCubeResidues q m c) (fun _ => hm) (fun _ => hmM) hsize).mean (fun x => f (shiftScalarCube c (fun i => (x i : ℤ)))) = 𝔼 p : SupportedCube q (integerProgressionSupport c (m : ℤ) H : Set ℤ), f (supportedCubeCoordinates p.val) := by rw [affineScalarCubeWindowWeights_supported_mean] exact (Fintype.expect_equiv (progressionResidueSupportedCubeEquiv q m H c hm) _ _ (fun _ => rfl)).symm
end Erdos3
end
section
namespace Erdos3
theorem scalarKernelCutoff_window_size (I J : Type*) [Fintype I] [Fintype J] {M D L K : ℕ} {η : ℝ} (hM : 0 < M) (hD : 0 < D) (hη : 0 < η) (hlarge : scalarKernelCutoff I J M D η ≤ L) (hDK : L ≤ D * K) : (Fintype.card I + 1) * M ≤ K := scalarCubeWindow_size hD ((scalarKernelCutoff_bounds I J hM hD hη).2.2.1.trans hlarge) hDK
theorem affineKernel_explicit_probability_le (I J : Type*) [Fintype I] [DecidableEq I] [Nonempty I] [Fintype J] [DecidableEq J] (hJ : Fintype.card J = Fintype.card I * (Fintype.card I + 2)) (s : I ↪ J) {M D L : ℕ} {η : ℝ} (hM : 0 < M) (hD : 0 < D) (hη : 0 < η) (hL : 0 < L) (hlarge : scalarKernelCutoff I J M D η ≤ L) (K : J → ℕ) (hKL : ∀ j, K j ≤ L) (hDK : ∀ j, L ≤ D * K j) (c : J → ℤ) (m : J → Option I → ℕ) (r : ∀ j i, ZMod (m j i)) (hm : ∀ j i, 0 < m j i) (hmM : ∀ j i, m j i ≤ M) : (FiniteProbabilityWeights.pi (fun j => affineScalarCubeWindowWeights I L (K j) M D (c j) hL (hKL j) (hDK j) (m j) (r j) (hm j) (hmM j) (scalarKernelCutoff_window_size I J hM hD hη hlarge (hDK j)))).eventProbability (fun x => ¬ GoodScalarKernelTuple s (1 / (scalarKernelCutoff I J M D η : ℝ)) (scalarKernelCutoff I J M D η) x) ≤ η := by let C := scalarKernelConditioningConstant I J M D have hC : 0 < C := scalarKernelConditioningConstant_pos I J hM hD have h := scalarCubeWindow_pi_eventProbability_le I J L M D K hL hKL hDK m (fun j => shiftScalarCubeResidues (c j) (m j) (r j)) hm hmM (fun j => scalarKernelCutoff_window_size I J hM hD hη hlarge (hDK j)) (fun x => ¬ GoodScalarKernelTuple s (1 / (scalarKernelCutoff I J M D η : ℝ)) (scalarKernelCutoff I J M D η) x) apply h.trans calc _ ≤ C * scalarKernelAdjustedAccuracy I J M D η := mul_le_mul_of_nonneg_left (scalarKernel_explicit_probability_le I J hJ s hM hD hη hL hlarge) hC.le _ = η := by change C * (η / C) = η field_simp
end Erdos3
end
section
namespace Erdos3
theorem exists_affine_window_good_scalar_kernel_bound (I J : Type*) [Fintype I] [DecidableEq I] [Nonempty I] [Fintype J] [DecidableEq J] (hJ : Fintype.card J = Fintype.card I * (Fintype.card I + 2)) : ∃ s : I ↪ J, ∀ (M D : ℕ), 0 < M → ∀ hD : 0 < D, ∀ η : ℝ, 0 < η → ∃ B L₀ : ℕ, 0 < B ∧ ∃ hsize : D * ((Fintype.card I + 1) * M) ≤ L₀, ∀ (L : ℕ) (hL : 0 < L) (hlarge : L₀ ≤ L) (K : J → ℕ) (hKL : ∀ j, K j ≤ L) (hDK : ∀ j, L ≤ D * K j) (c : J → ℤ) (m : J → Option I → ℕ) (r : ∀ j i, ZMod (m j i)) (hm : ∀ j i, 0 < m j i) (hmM : ∀ j i, m j i ≤ M), (FiniteProbabilityWeights.pi (fun j => affineScalarCubeWindowWeights I L (K j) M D (c j) hL (hKL j) (hDK j) (m j) (r j) (hm j) (hmM j) (scalarCubeWindow_size hD (hsize.trans hlarge) (hDK j)))).eventProbability (fun x => ¬ GoodScalarKernelTuple s (1 / (B : ℝ)) B x) ≤ η := by obtain ⟨s, hs⟩ := exists_window_good_scalar_kernel_bound I J hJ refine ⟨s, fun M D hM hD η hη => ?_⟩ obtain ⟨B, L₀, hB, hsize, hprob⟩ := hs M D hM hD η hη refine ⟨B, L₀, hB, hsize, ?_⟩ intro L hL hlarge K hKL hDK c m r hm hmM exact hprob L hL hlarge K hKL hDK m (fun j => shiftScalarCubeResidues (c j) (m j) (r j)) hm hmM
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167import OAI.Combinatorics.Progressions.Polynomial.IntegerPolynomialDenominatorGridimport OAI.Combinatorics.Progressions.Polynomial.TranslationPhaseQuotient
namespace OAI
section
namespace Erdos3
open MvPolynomial
variable {σ τ : Type*}
theorem weightedHomogeneousComponent_fractional_restoration (F : MvPolynomial σ ℝ) (w : σ → ℕ) (d : ℕ) : weightedHomogeneousComponent w d F = weightedHomogeneousComponent w d (fractionalCoefficientPolynomial F) + MvPolynomial.map (Int.castRingHom ℝ) (weightedHomogeneousComponent w d (floorIntegerPolynomial F)) := by classical conv_lhs => rw [← floorIntegerPolynomial_add_fractionalCoefficientPolynomial F] rw [map_add, add_comm] congr 1 ext a simp only [coeff_weightedHomogeneousComponent, coeff_map] split_ifs <;> simp
noncomputable def restoredMajorRemainder (F : MvPolynomial σ ℝ) (w : σ → ℕ) (d : ℕ) (R : MvPolynomial σ ℚ) : MvPolynomial σ ℚ := R + MvPolynomial.map (Int.castRingHom ℚ) (weightedHomogeneousComponent w d (floorIntegerPolynomial F))
theorem restoredMajorRemainder_coefficientGrid (F : MvPolynomial σ ℝ) (w : σ → ℕ) (d : ℕ) (R : MvPolynomial σ ℚ) (q : ℕ) (hR : (fun a => R.coeff a) ∈ denominatorGrid q) : (fun a => (restoredMajorRemainder F w d R).coeff a) ∈ denominatorGrid q := add_integerPolynomial_coefficientGrid R (weightedHomogeneousComponent w d (floorIntegerPolynomial F)) q hR
theorem integerPolynomial_map_rat_real (I : MvPolynomial σ ℤ) : MvPolynomial.map (algebraMap ℚ ℝ) (MvPolynomial.map (Int.castRingHom ℚ) I) = MvPolynomial.map (Int.castRingHom ℝ) I := by ext a simp only [coeff_map] simp
theorem restoredMajorRemainder_eval (F : MvPolynomial σ ℝ) (w : σ → ℕ) (d : ℕ) (R : MvPolynomial σ ℚ) (z : σ → ℝ) : eval₂ (algebraMap ℚ ℝ) z (restoredMajorRemainder F w d R) = eval₂ (algebraMap ℚ ℝ) z R + eval z (MvPolynomial.map (Int.castRingHom ℝ) (weightedHomogeneousComponent w d (floorIntegerPolynomial F))) := by rw [restoredMajorRemainder, eval₂_add] congr 1 rw [← eval_map, integerPolynomial_map_rat_real]
theorem restoredMajorRemainder_isWeightedHomogeneous (F : MvPolynomial σ ℝ) (w : σ → ℕ) (d : ℕ) (R : MvPolynomial σ ℚ) (hR : R.IsWeightedHomogeneous w d) : (restoredMajorRemainder F w d R).IsWeightedHomogeneous w d := by apply hR.add intro a ha apply weightedHomogeneousComponent_isWeightedHomogeneous (w := w) d (floorIntegerPolynomial F) intro hz apply ha simp only [coeff_map, hz, map_zero]
theorem restoredMajorRemainder_degree (F : MvPolynomial σ ℝ) (w : σ → ℕ) (d : ℕ) (R : MvPolynomial σ ℚ) (hR : R ∈ weightedSupportLE w d) : restoredMajorRemainder F w d R ∈ weightedSupportLE w d := by apply (weightedSupportLE w d).add_mem hR intro a ha have hi : (MvPolynomial.map (Int.castRingHom ℚ) (weightedHomogeneousComponent w d (floorIntegerPolynomial F))).IsWeightedHomogeneous w d := by intro a ha apply weightedHomogeneousComponent_isWeightedHomogeneous (w := w) d (floorIntegerPolynomial F) intro hz apply ha simp only [coeff_map, hz, map_zero] exact (hi (mem_support_iff.mp ha)).le
theorem restoredMajorRemainder_totalDegree_le (F : MvPolynomial σ ℝ) (w : σ → ℕ) (hw : ∀ i, 0 < w i) (d : ℕ) (R : MvPolynomial σ ℚ) {r : ℕ} (hR : R.totalDegree ≤ r) (hdr : d ≤ r) : (restoredMajorRemainder F w d R).totalDegree ≤ r := by have hI : MvPolynomial.map (Int.castRingHom ℚ) (weightedHomogeneousComponent w d (floorIntegerPolynomial F)) ∈ weightedSupportLE w d := by simpa only [restoredMajorRemainder, zero_add] using restoredMajorRemainder_degree F w d 0 (Submodule.zero_mem _) have hdeg : (MvPolynomial.map (Int.castRingHom ℚ) (weightedHomogeneousComponent w d (floorIntegerPolynomial F))).totalDegree ≤ d := by unfold totalDegree apply Finset.sup_le intro a ha exact (exponentSum_le_positive_weight w hw a).trans (hI ha) exact (totalDegree_add _ _).trans (max_le hR (hdeg.trans hdr))
theorem algebraic_major_integer_restoration_identity (F : MvPolynomial σ ℝ) (w : σ → ℕ) (d : ℕ) (S : MvPolynomial τ ℝ) (R : MvPolynomial σ ℚ) (chart : (σ → ℝ) → (τ → ℝ)) (Ω : Set (σ → ℝ)) (hidentity : ∀ z ∈ Ω, eval z (weightedHomogeneousComponent w d (fractionalCoefficientPolynomial F)) = eval (chart z) S + eval₂ (algebraMap ℚ ℝ) z R) (z : σ → ℝ) (hz : z ∈ Ω) : eval z (weightedHomogeneousComponent w d F) = eval (chart z) S + eval₂ (algebraMap ℚ ℝ) z (restoredMajorRemainder F w d R) := by rw [weightedHomogeneousComponent_fractional_restoration, map_add, hidentity z hz, restoredMajorRemainder_eval, add_assoc]
theorem algebraic_major_restore_integer_coefficients {U B : Type*} (F : MvPolynomial (U ⊕ B) ℝ) (w : U ⊕ B → ℕ) (d : ℕ) (K : Submodule ℝ (B → ℝ)) (A : B → MvPolynomial U ℝ) (H : U → ℝ) (S : MvPolynomial (U ⊕ B) ℝ) (R : MvPolynomial (U ⊕ B) ℚ) (q : ℕ) (hgrid : (fun a => R.coeff a) ∈ denominatorGrid q) (hdegree : R ∈ weightedSupportLE w d) (hidentity : ∀ (u : U → ℝ) (b : B → ℝ), b ∈ K → eval (Sum.elim u b) (weightedHomogeneousComponent w d (fractionalCoefficientPolynomial F)) = eval (Sum.elim (fun i => u i / H i) (fun j => b j - eval u (A j))) S + eval₂ (algebraMap ℚ ℝ) (Sum.elim u b) R) : let R' := restoredMajorRemainder F w d R (fun a => R'.coeff a) ∈ denominatorGrid q ∧ R' ∈ weightedSupportLE w d ∧ ∀ (u : U → ℝ) (b : B → ℝ), b ∈ K → eval (Sum.elim u b) (weightedHomogeneousComponent w d F) = eval (Sum.elim (fun i => u i / H i) (fun j => b j - eval u (A j))) S + eval₂ (algebraMap ℚ ℝ) (Sum.elim u b) R' := by refine ⟨restoredMajorRemainder_coefficientGrid F w d R q hgrid, restoredMajorRemainder_degree F w d R hdegree, ?_⟩ intro u b hb rw [weightedHomogeneousComponent_fractional_restoration, map_add, hidentity u b hb, restoredMajorRemainder_eval, add_assoc]
theorem algebraic_major_restore_integer_coefficients_totalDegree {U B : Type*} (F : MvPolynomial (U ⊕ B) ℝ) (w : U ⊕ B → ℕ) (hw : ∀ i, 0 < w i) (d : ℕ) (K : Submodule ℝ (B → ℝ)) (A : B → MvPolynomial U ℝ) (H : U → ℝ) (S : MvPolynomial (U ⊕ B) ℝ) (R : MvPolynomial (U ⊕ B) ℚ) (q r : ℕ) (hgrid : (fun a => R.coeff a) ∈ denominatorGrid q) (hdegree : R.totalDegree ≤ r) (hdr : d ≤ r) (hidentity : ∀ (u : U → ℝ) (b : B → ℝ), b ∈ K → eval (Sum.elim u b) (weightedHomogeneousComponent w d (fractionalCoefficientPolynomial F)) = eval (Sum.elim (fun i => u i / H i) (fun j => b j - eval u (A j))) S + eval₂ (algebraMap ℚ ℝ) (Sum.elim u b) R) : let R' := restoredMajorRemainder F w d R (fun a => R'.coeff a) ∈ denominatorGrid q ∧ R'.totalDegree ≤ r ∧ ∀ (u : U → ℝ) (b : B → ℝ), b ∈ K → eval (Sum.elim u b) (weightedHomogeneousComponent w d F) = eval (Sum.elim (fun i => u i / H i) (fun j => b j - eval u (A j))) S + eval₂ (algebraMap ℚ ℝ) (Sum.elim u b) R' := by refine ⟨restoredMajorRemainder_coefficientGrid F w d R q hgrid, restoredMajorRemainder_totalDegree_le F w hw d R hdegree hdr, ?_⟩ intro u b hb rw [weightedHomogeneousComponent_fractional_restoration, map_add, hidentity u b hb, restoredMajorRemainder_eval, add_assoc]
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528import OAI.Combinatorics.Progressions.Polynomial.MajorTranslationPolynomialSymbolDegreeimport OAI.Combinatorics.Progressions.Polynomial.TranslationPhaseQuotientimport OAI.Combinatorics.Progressions.Polynomial.TranslationTopDegree
namespace OAI
section
namespace Erdos3open MvPolynomial
variable {U B : Type*}
noncomputable def majorSlowDilationPullback (q : ℕ) (H T : U → ℝ) (S : MvPolynomial (U ⊕ B) ℝ) : MvPolynomial (U ⊕ B) ℝ := scaleMvPolynomialAxes (Sum.elim (fun i => H i / ((q : ℝ) * T i)) (fun _ : B => 1)) S
theorem majorSlowDilationPullback_eval (q : ℕ) (hq : 0 < q) (H T : U → ℝ) (hH : ∀ i, 0 < H i) (hT : ∀ i, 0 < T i) (S : MvPolynomial (U ⊕ B) ℝ) (u : U → ℝ) (z : B → ℝ) : eval (Sum.elim (fun i => u i / H i) z) (majorSlowDilationPullback q H T S) = eval (Sum.elim (fun i => (u i / (q : ℝ)) / T i) z) S := by rw [majorSlowDilationPullback, scaleMvPolynomialAxes_eval] apply congrArg (fun x : U ⊕ B → ℝ => eval x S) funext j cases j with | inl i => dsimp only [Sum.elim_inl] field_simp [(hH i).ne', (hT i).ne', (Nat.cast_pos.mpr hq : (0 : ℝ) < q).ne'] | inr j => simp only [Sum.elim_inr, one_mul]
theorem majorSlowDilationPullback_totalDegree_le (q : ℕ) (H T : U → ℝ) (S : MvPolynomial (U ⊕ B) ℝ) : (majorSlowDilationPullback q H T S).totalDegree ≤ S.totalDegree := scaleMvPolynomialAxes_totalDegree_le _ _
theorem algebraic_major_dilation_pullback_identity (K : Submodule ℝ (B → ℝ)) (D : MvPolynomial (U ⊕ B) ℝ) (A : B → MvPolynomial U ℝ) (S : MvPolynomial (U ⊕ B) ℝ) (R : MvPolynomial (U ⊕ B) ℚ) (q : ℕ) (hq : 0 < q) (H T : U → ℝ) (hH : ∀ i, 0 < H i) (hT : ∀ i, 0 < T i) (hsource : ∀ (v : U → ℝ) (b : B → ℝ), b ∈ K → eval (Sum.elim (fun i => (q : ℝ) * v i) b) D = eval (Sum.elim (fun i => v i / T i) (fun j => b j - eval (fun i => (q : ℝ) * v i) (A j))) S + eval₂ (algebraMap ℚ ℝ) (Sum.elim v b) R) (u : U → ℝ) (b : B → ℝ) (hb : b ∈ K) : eval (Sum.elim u b) D = eval (Sum.elim (fun i => u i / H i) (fun j => b j - eval u (A j))) (majorSlowDilationPullback q H T S) + eval₂ (algebraMap ℚ ℝ) (Sum.elim u b) (jointRationalPolynomialDilation q R) := by rw [majorSlowDilationPullback_eval q hq H T hH hT, jointRationalPolynomialDilation_eval₂] have hcancel : (fun i => (q : ℝ) * (u i / (q : ℝ))) = u := by funext i exact mul_div_cancel₀ (u i) (Nat.cast_ne_zero.mpr hq.ne') simpa only [hcancel] using hsource (fun i => u i / (q : ℝ)) b hb
theorem majorSlowDilationPullback_mass_le (q : ℕ) (hq : 0 < q) (H T : U → ℝ) (hH : ∀ i, 0 < H i) (hT : ∀ i, 0 < T i) (S : MvPolynomial (U ⊕ B) ℝ) {c : ℝ} (hc : 1 ≤ c) (hHT : ∀ i, H i ≤ c * (q : ℝ) * T i) {d : ℕ} (hS : S.totalDegree ≤ d) : realPolynomialMass (majorSlowDilationPullback q H T S) ≤ c^d * realPolynomialMass S := by apply jointPolynomialDilation_mass_le _ S hc _ hS intro i have hqT : 0 < (q : ℝ) * T i := mul_pos (Nat.cast_pos.mpr hq) (hT i) rw [abs_of_nonneg (div_nonneg (hH i).le hqT.le)] apply (div_le_iff₀ hqT).mpr simpa only [mul_assoc] using hHT i
theorem algebraic_major_dilation_pullback_decomposition (K : Submodule ℝ (B → ℝ)) (D : MvPolynomial (U ⊕ B) ℝ) (A : B → MvPolynomial U ℝ) (S : MvPolynomial (U ⊕ B) ℝ) (R : MvPolynomial (U ⊕ B) ℚ) (q : ℕ) (hq : 0 < q) (H T : U → ℝ) (hH : ∀ i, 0 < H i) (hT : ∀ i, 0 < T i) (hsource : ∀ (v : U → ℝ) (b : B → ℝ), b ∈ K → eval (Sum.elim (fun i => (q : ℝ) * v i) b) D = eval (Sum.elim (fun i => v i / T i) (fun j => b j - eval (fun i => (q : ℝ) * v i) (A j))) S + eval₂ (algebraMap ℚ ℝ) (Sum.elim v b) R) (c C : ℝ) (hc : 1 ≤ c) (hHT : ∀ i, H i ≤ c * (q : ℝ) * T i) (d l : ℕ) (hS : S.totalDegree ≤ d) (hR : R.totalDegree ≤ d) (hSmass : realPolynomialMass S ≤ C) (hRgrid : (fun α => R.coeff α) ∈ denominatorGrid l) : ∃ (S' : MvPolynomial (U ⊕ B) ℝ) (R' : MvPolynomial (U ⊕ B) ℚ), (∀ (u : U → ℝ) (b : B → ℝ), b ∈ K → eval (Sum.elim u b) D = eval (Sum.elim (fun i => u i / H i) (fun j => b j - eval u (A j))) S' + eval₂ (algebraMap ℚ ℝ) (Sum.elim u b) R') ∧ realPolynomialMass S' ≤ c^d * C ∧ S'.totalDegree ≤ d ∧ R'.totalDegree ≤ d ∧ (fun α => R'.coeff α) ∈ denominatorGrid (q^d*l) := by refine ⟨majorSlowDilationPullback q H T S, jointRationalPolynomialDilation q R, algebraic_major_dilation_pullback_identity K D A S R q hq H T hH hT hsource, ?_, (majorSlowDilationPullback_totalDegree_le q H T S).trans hS, (jointRationalPolynomialDilation_totalDegree_le q R).trans hR, ?_⟩ · exact (majorSlowDilationPullback_mass_le q hq H T hH hT S hc hHT hS).trans (mul_le_mul_of_nonneg_left hSmass (pow_nonneg (le_trans zero_le_one hc) d)) · exact jointRationalPolynomialDilation_denominatorGrid R q l d hq hR hRgrid
end Erdos3
end
section
namespace Erdos3
open MvPolynomial
variable {U B : Type*}
theorem majorSlowDilationPullback_mem_weightedSupportLE (q : ℕ) (H T : U → ℝ) (S : MvPolynomial (U ⊕ B) ℝ) (w : U ⊕ B → ℕ) (d : ℕ) (hS : S ∈ weightedSupportLE w d) : majorSlowDilationPullback q H T S ∈ weightedSupportLE w d := scaleMvPolynomialAxes_mem_weightedSupportLE _ w d hS
theorem algebraic_major_weighted_dilation_pullback_decomposition (w : B → ℕ) (hw : ∀ i, 0 < w i) (K : Submodule ℝ (B → ℝ)) (D : MvPolynomial (U ⊕ B) ℝ) (A : B → MvPolynomial U ℝ) (S : MvPolynomial (U ⊕ B) ℝ) (R : MvPolynomial (U ⊕ B) ℚ) (q : ℕ) (hq : 0 < q) (H T : U → ℝ) (hH : ∀ i, 0 < H i) (hT : ∀ i, 0 < T i) (hsource : ∀ (v : U → ℝ) (b : B → ℝ), b ∈ K → eval (Sum.elim (fun i => (q : ℝ) * v i) b) D = eval (Sum.elim (fun i => v i / T i) (fun j => b j - eval (fun i => (q : ℝ) * v i) (A j))) S + eval₂ (algebraMap ℚ ℝ) (Sum.elim v b) R) (c C : ℝ) (hc : 1 ≤ c) (hHT : ∀ i, H i ≤ c * (q : ℝ) * T i) (d l : ℕ) (hS : S ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d) (hR : R ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d) (hSmass : realPolynomialMass S ≤ C) (hRgrid : (fun α => R.coeff α) ∈ denominatorGrid l) : ∃ (S' : MvPolynomial (U ⊕ B) ℝ) (R' : MvPolynomial (U ⊕ B) ℚ), S' = majorSlowDilationPullback q H T S ∧ R' = jointRationalPolynomialDilation q R ∧ (∀ (u : U → ℝ) (b : B → ℝ), b ∈ K → eval (Sum.elim u b) D = eval (Sum.elim (fun i => u i / H i) (fun j => b j - eval u (A j))) S' + eval₂ (algebraMap ℚ ℝ) (Sum.elim u b) R') ∧ realPolynomialMass S' ≤ c^d * C ∧ S' ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d ∧ R' ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d ∧ S'.totalDegree ≤ d ∧ R'.totalDegree ≤ d ∧ (fun α => R'.coeff α) ∈ denominatorGrid (q^d*l) := by have hpos : ∀ i : U ⊕ B, 0 < Sum.elim (fun _ : U => 1) w i := Sum.rec (fun _ => Nat.zero_lt_one) hw have hSdeg := weightedSupportLE_totalDegree_le_of_pos hpos hS have hRdeg := weightedSupportLE_totalDegree_le_of_pos hpos hR have hS' := majorSlowDilationPullback_mem_weightedSupportLE q H T S _ d hS have hR' := jointRationalPolynomialDilation_mem_weightedSupportLE q R _ d hR refine ⟨majorSlowDilationPullback q H T S, jointRationalPolynomialDilation q R, rfl, rfl, algebraic_major_dilation_pullback_identity K D A S R q hq H T hH hT hsource, ?_, hS', hR', weightedSupportLE_totalDegree_le_of_pos hpos hS', weightedSupportLE_totalDegree_le_of_pos hpos hR', ?_⟩ · exact (majorSlowDilationPullback_mass_le q hq H T hH hT S hc hHT hSdeg).trans (mul_le_mul_of_nonneg_left hSmass (pow_nonneg (le_trans zero_le_one hc) d)) · exact jointRationalPolynomialDilation_denominatorGrid R q l d hq hRdeg hRgrid
end Erdos3
end
section
namespace Erdos3
open MvPolynomialopen scoped BigOperators TensorProduct
variable {U R : Type*} [CommRing R]
theorem homogeneousComponent_polynomialTranslate (h : ℕ) (r : U → R) (P : MvPolynomial U R) (hP : P.totalDegree ≤ h) : homogeneousComponent h (polynomialTranslate r P) = homogeneousComponent h P := by have hp : VectorPolynomial.DegreeLE (1 : U → ℕ) h (P ⊗ₜ[R] (1 : R)) := by intro α hα have hz : P.coeff α = 0 := coeff_eq_zero_of_totalDegree_lt (hP.trans_lt (by simpa only [Finsupp.weight_apply, Finsupp.sum, Pi.one_apply, smul_eq_mul, mul_one] using hα)) simp only [VectorPolynomial.coefficients_tmul, hz, zero_smul] have ht := VectorPolynomial.homogeneousPart_translate r (P ⊗ₜ[R] (1 : R)) hp ext α have hc := congrArg (fun p => VectorPolynomial.coefficients p α) ht simpa only [VectorPolynomial.translate_tmul, VectorPolynomial.homogeneousPart_tmul, VectorPolynomial.coefficients_tmul, smul_eq_mul, mul_one] using hc
theorem polynomial_dilation_monomial (a c : R) (α : U →₀ ℕ) : aeval (fun i => C a * X i) (monomial α c) = monomial α (a ^ α.degree * c) := by classical rw [aeval_monomial] simp only [algebraMap_eq, Finsupp.prod, mul_pow, Finset.prod_mul_distrib, ← map_pow, ← map_prod, Finset.prod_pow_eq_pow_sum, prod_X_pow_eq_monomial] rw [monomial_eq, monomial_eq] simp only [map_one, one_mul, map_mul] have hd : (∑ i ∈ α.support, α i) = α.degree := rfl rw [hd] ring
theorem coeff_polynomial_dilation (a : R) (P : MvPolynomial U R) (α : U →₀ ℕ) : (aeval (fun i => C a * X i) P).coeff α = a ^ α.degree * P.coeff α := by classical conv_lhs => rw [P.as_sum] simp only [map_sum, polynomial_dilation_monomial, coeff_sum, coeff_monomial] by_cases hα : α ∈ P.support · rw [Finset.sum_eq_single α] · simp · intro β hβ hβα simp [hβα] · exact fun h => (h hα).elim · rw [Finset.sum_eq_zero] · have hz : P.coeff α = 0 := not_ne_iff.mp (fun h => hα (mem_support_iff.mpr h)) simp only [hz, mul_zero] · intro β hβ have hβα : β ≠ α := by rintro rfl; exact hα hβ simp [hβα]
theorem homogeneousComponent_polynomial_dilation (h : ℕ) (a : R) (P : MvPolynomial U R) : homogeneousComponent h (aeval (fun i => C a * X i) P) = C (a ^ h) * homogeneousComponent h P := by classical ext α rw [coeff_homogeneousComponent, coeff_polynomial_dilation, coeff_C_mul, coeff_homogeneousComponent] by_cases hα : α.degree = h · simp only [hα, ite_true] · simp only [hα, ite_false, mul_zero]
theorem residueAffinePolynomial_eq_dilation_translate (q : ℕ) (r : U → ℤ) (P : MvPolynomial U ℝ) : residueAffinePolynomial q r P = aeval (fun i => C (q : ℝ) * X i) (polynomialTranslate (fun i => (r i : ℝ)) P) := by induction P using MvPolynomial.induction_on with | C c => simp [residueAffinePolynomial] | add P Q hP hQ => simpa only [residueAffinePolynomial, map_add] using congrArg₂ (· + ·) hP hQ | mul_X P i hP => simp only [residueAffinePolynomial, map_mul, eval₂Hom_X', polynomialTranslate_X, map_add, aeval_X, aeval_C, algebraMap_eq] at * rw [hP, add_comm (C (r i : ℝ))]
theorem residueAffinePolynomial_homogeneousComponent (q h : ℕ) (r : U → ℤ) (P : MvPolynomial U ℝ) (hP : P.totalDegree ≤ h) : homogeneousComponent h (residueAffinePolynomial q r P) = C ((q : ℝ) ^ h) * homogeneousComponent h P := by rw [residueAffinePolynomial_eq_dilation_translate, homogeneousComponent_polynomial_dilation, homogeneousComponent_polynomialTranslate h _ P hP]
end Erdos3
end
section
namespace Erdos3
open MvPolynomial
variable {U : Type*}
theorem residueAffinePolynomial_homogeneousComponent_eval (q h : ℕ) (r : U → ℤ) (P : MvPolynomial U ℝ) (hP : P.totalDegree ≤ h) (v : U → ℝ) : eval v (homogeneousComponent h (residueAffinePolynomial q r P)) = eval (fun i => (q : ℝ) * v i) (homogeneousComponent h P) := by have hdil : C ((q : ℝ) ^ h) * homogeneousComponent h P = aeval (fun i => C (q : ℝ) * X i) (homogeneousComponent h P) := by classical ext α rw [coeff_C_mul, coeff_polynomial_dilation, coeff_homogeneousComponent] by_cases hα : α.degree = h · simp only [hα, ite_true] · simp only [hα, ite_false, mul_zero] rw [residueAffinePolynomial_homogeneousComponent q h r P hP, hdil] change (aeval v) (aeval (fun i => C (q : ℝ) * X i) (homogeneousComponent h P)) = _ rw [comp_aeval_apply] simp only [map_mul, aeval_C, aeval_X, Algebra.algebraMap_self, RingHom.id_apply, aeval_eq_eval]
theorem residueAffinePolynomial_weightedHomogeneousComponent_eval (q h : ℕ) (r : U → ℤ) (P : MvPolynomial U ℝ) (hP : P.totalDegree ≤ h) (v : U → ℝ) : eval v (weightedHomogeneousComponent (fun _ : U => 1) h (residueAffinePolynomial q r P)) = eval (fun i => (q : ℝ) * v i) (weightedHomogeneousComponent (fun _ : U => 1) h P) := residueAffinePolynomial_homogeneousComponent_eval q h r P hP v
end Erdos3
end
section
namespace Erdos3
open MvPolynomial
variable {U B : Type*}
noncomputable def jointResidueAffinePolynomial (q : ℕ) (r : U → ℤ) (D : MvPolynomial (U ⊕ B) ℝ) : MvPolynomial (U ⊕ B) ℝ := aeval (Sum.elim (fun i => C (r i : ℝ) + C (q : ℝ) * X (Sum.inl i)) (fun j => X (Sum.inr j))) D
theorem jointResidueAffinePolynomial_eval (q : ℕ) (r : U → ℤ) (D : MvPolynomial (U ⊕ B) ℝ) (u : U → ℝ) (b : B → ℝ) : eval (Sum.elim u b) (jointResidueAffinePolynomial q r D) = eval (Sum.elim (fun i => (r i : ℝ) + (q : ℝ) * u i) b) D := by induction D using MvPolynomial.induction_on with | C c => simp [jointResidueAffinePolynomial] | add D E hD hE => simpa only [jointResidueAffinePolynomial, map_add] using congrArg₂ (· + ·) hD hE | mul_X D i hD => cases i <;> simp [jointResidueAffinePolynomial, map_mul] at hD ⊢ <;> rw [hD] <;> simp
private theorem jointResidueAffine_variables_degree (w : B → ℕ) (q : ℕ) (r : U → ℤ) (i : U ⊕ B) : Sum.elim (fun j => C (r j : ℝ) + C (q : ℝ) * X (Sum.inl j)) (fun j => X (Sum.inr j)) i ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) (Sum.elim (fun _ : U => 1) w i) := by cases i with | inl i => apply (weightedSupportLE _ _).add_mem (weightedSupportLE_C _ _ _) simpa only [zero_add] using weightedSupportLE_mul (weightedSupportLE_C (Sum.elim (fun _ : U => 1) w) 0 (q : ℝ)) (weightedSupportLE_X (Sum.elim (fun _ : U => 1) w) (Sum.inl i)) | inr j => exact weightedSupportLE_X (Sum.elim (fun _ : U => 1) w) (Sum.inr j)
theorem jointResidueAffinePolynomial_degree (w : B → ℕ) (q : ℕ) (r : U → ℤ) {d : ℕ} {D : MvPolynomial (U ⊕ B) ℝ} (hD : D ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d) : jointResidueAffinePolynomial q r D ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d := weightedSupportLE_aeval _ _ _ (jointResidueAffine_variables_degree w q r) hD
theorem jointResidueAffinePolynomial_sub_axes_lower (w : B → ℕ) (q : ℕ) (r : U → ℤ) {d : ℕ} {D : MvPolynomial (U ⊕ B) ℝ} (hD : D ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d) : jointResidueAffinePolynomial q r D - scaleMvPolynomialAxes (Sum.elim (fun _ : U => (q : ℝ)) (fun _ : B => 1)) D ∈ weightedSupportLT (Sum.elim (fun _ : U => 1) w) d := by let v := Sum.elim (fun _ : U => 1) w let F : MvPolynomial (U ⊕ B) ℝ →ₐ[ℝ] MvPolynomial (U ⊕ B) ℝ := aeval (R := ℝ) (Sum.elim (fun i => C (r i : ℝ) + C (q : ℝ) * X (Sum.inl i)) (fun j => X (Sum.inr j))) let T := Sum.elim (fun _ : U => (q : ℝ)) (fun _ : B => 1) let G := aeval (R := ℝ) (fun i : U ⊕ B => C (T i) * X i) have hF : ∀ i, F (X i) ∈ weightedSupportLE v (v i) := by intro i simpa only [F, aeval_X] using jointResidueAffine_variables_degree w q r i have hG : ∀ i, G (X i) ∈ weightedSupportLE v (v i) := by intro i simpa only [G, aeval_X, zero_add] using weightedSupportLE_mul (weightedSupportLE_C v 0 (T i)) (weightedSupportLE_X v i) have hdiff : ∀ i, F (X i) - G (X i) ∈ weightedSupportLT v (v i) := by intro i cases i with | inl i => simp only [F, G, T, aeval_X, Sum.elim_inl, add_sub_cancel_right] exact weightedSupportLE_lt_succ (weightedSupportLE_C v 0 (r i : ℝ)) | inr j => simp only [F, G, T, aeval_X, Sum.elim_inr, map_one, one_mul, sub_self] exact Submodule.zero_mem _ rw [scaleMvPolynomialAxes_eq_aeval] exact weightedComparison_difference v v F G hF hG hdiff hD
theorem jointResidueAffinePolynomial_weightedHomogeneousComponent (w : B → ℕ) (q d : ℕ) (r : U → ℤ) (D : MvPolynomial (U ⊕ B) ℝ) (hD : D ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d) : weightedHomogeneousComponent (Sum.elim (fun _ : U => 1) w) d (jointResidueAffinePolynomial q r D) = scaleMvPolynomialAxes (Sum.elim (fun _ : U => (q : ℝ)) (fun _ : B => 1)) (weightedHomogeneousComponent (Sum.elim (fun _ : U => 1) w) d D) := by have hlower := jointResidueAffinePolynomial_sub_axes_lower w q r hD have hzero : weightedHomogeneousComponent (Sum.elim (fun _ : U => 1) w) d (jointResidueAffinePolynomial q r D - scaleMvPolynomialAxes (Sum.elim (fun _ : U => (q : ℝ)) (fun _ : B => 1)) D) = 0 := weightedHomogeneousComponent_eq_zero' d _ (fun α hα => (hlower hα).ne) rw [map_sub, sub_eq_zero] at hzero rw [hzero, scaleMvPolynomialAxes_weightedHomogeneousComponent]
end Erdos3
end
section
namespace Erdos3open MvPolynomial
variable {U B : Type*}
theorem jointResidueAffinePolynomial_weightedHomogeneousComponent_eval (w : B → ℕ) (q d : ℕ) (r : U → ℤ) (D : MvPolynomial (U ⊕ B) ℝ) (hD : D ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d) (v : U → ℝ) (b : B → ℝ) : eval (Sum.elim v b) (weightedHomogeneousComponent (Sum.elim (fun _ : U => 1) w) d (jointResidueAffinePolynomial q r D)) = eval (Sum.elim (fun i => (q : ℝ) * v i) b) (weightedHomogeneousComponent (Sum.elim (fun _ : U => 1) w) d D) := by rw [jointResidueAffinePolynomial_weightedHomogeneousComponent w q d r D hD, scaleMvPolynomialAxes_eval] apply congrArg (fun x : U ⊕ B → ℝ => eval x _) funext i cases i <;> simp only [Sum.elim_inl, Sum.elim_inr, one_mul]
theorem algebraic_major_affine_top_dilation_identity (K : Submodule ℝ (B → ℝ)) (w : B → ℕ) (n : ℕ) (D : MvPolynomial (U ⊕ B) ℝ) (hD : D ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) n) (A : B → MvPolynomial U ℝ) (hA : ∀ j, (A j).totalDegree ≤ w j) (S : MvPolynomial (U ⊕ B) ℝ) (R : MvPolynomial (U ⊕ B) ℚ) (q : ℕ) (r : U → ℤ) (T : U → ℝ) (hsource : ∀ (v : U → ℝ) (b : B → ℝ), b ∈ K → eval (Sum.elim v b) (weightedHomogeneousComponent (Sum.elim (fun _ : U => 1) w) n (jointResidueAffinePolynomial q r D)) = eval (Sum.elim (fun i => v i / T i) (fun j => b j - eval v (majorTranslationTopCoordinates w (fun j => residueAffinePolynomial q r (A j)) j))) S + eval₂ (algebraMap ℚ ℝ) (Sum.elim v b) R) (v : U → ℝ) (b : B → ℝ) (hb : b ∈ K) : eval (Sum.elim (fun i => (q : ℝ) * v i) b) (weightedHomogeneousComponent (Sum.elim (fun _ : U => 1) w) n D) = eval (Sum.elim (fun i => v i / T i) (fun j => b j - eval (fun i => (q : ℝ) * v i) (majorTranslationTopCoordinates w A j))) S + eval₂ (algebraMap ℚ ℝ) (Sum.elim v b) R := by have h := hsource v b hb rw [jointResidueAffinePolynomial_weightedHomogeneousComponent_eval w q n r D hD] at h simp only [majorTranslationTopCoordinates, residueAffinePolynomial_weightedHomogeneousComponent_eval q _ r _ (hA _)] at h exact h
theorem algebraic_major_affine_top_pullback_decomposition (K : Submodule ℝ (B → ℝ)) (w : B → ℕ) (n : ℕ) (D : MvPolynomial (U ⊕ B) ℝ) (hD : D ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) n) (A : B → MvPolynomial U ℝ) (hA : ∀ j, (A j).totalDegree ≤ w j) (S : MvPolynomial (U ⊕ B) ℝ) (R : MvPolynomial (U ⊕ B) ℚ) (q : ℕ) (hq : 0 < q) (r : U → ℤ) (H T : U → ℝ) (hH : ∀ i, 0 < H i) (hT : ∀ i, 0 < T i) (hsource : ∀ (v : U → ℝ) (b : B → ℝ), b ∈ K → eval (Sum.elim v b) (weightedHomogeneousComponent (Sum.elim (fun _ : U => 1) w) n (jointResidueAffinePolynomial q r D)) = eval (Sum.elim (fun i => v i / T i) (fun j => b j - eval v (majorTranslationTopCoordinates w (fun j => residueAffinePolynomial q r (A j)) j))) S + eval₂ (algebraMap ℚ ℝ) (Sum.elim v b) R) (c C : ℝ) (hc : 1 ≤ c) (hHT : ∀ i, H i ≤ c * (q : ℝ) * T i) (d l : ℕ) (hS : S.totalDegree ≤ d) (hR : R.totalDegree ≤ d) (hSmass : realPolynomialMass S ≤ C) (hRgrid : (fun α => R.coeff α) ∈ denominatorGrid l) : ∃ (S' : MvPolynomial (U ⊕ B) ℝ) (R' : MvPolynomial (U ⊕ B) ℚ), (∀ (u : U → ℝ) (b : B → ℝ), b ∈ K → eval (Sum.elim u b) (weightedHomogeneousComponent (Sum.elim (fun _ : U => 1) w) n D) = eval (Sum.elim (fun i => u i / H i) (fun j => b j - eval u (majorTranslationTopCoordinates w A j))) S' + eval₂ (algebraMap ℚ ℝ) (Sum.elim u b) R') ∧ realPolynomialMass S' ≤ c^d * C ∧ S'.totalDegree ≤ d ∧ R'.totalDegree ≤ d ∧ (fun α => R'.coeff α) ∈ denominatorGrid (q^d*l) := algebraic_major_dilation_pullback_decomposition K _ _ S R q hq H T hH hT (algebraic_major_affine_top_dilation_identity K w n D hD A hA S R q r T hsource) c C hc hHT d l hS hR hSmass hRgrid
end Erdos3
end
section
namespace Erdos3
open MvPolynomial
variable {U B : Type*}
theorem algebraic_major_weighted_affine_top_pullback_decomposition (K : Submodule ℝ (B → ℝ)) (w : B → ℕ) (hw : ∀ i, 0 < w i) (n : ℕ) (D : MvPolynomial (U ⊕ B) ℝ) (hD : D ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) n) (A : B → MvPolynomial U ℝ) (hA : ∀ j, (A j).totalDegree ≤ w j) (S : MvPolynomial (U ⊕ B) ℝ) (R : MvPolynomial (U ⊕ B) ℚ) (q : ℕ) (hq : 0 < q) (r : U → ℤ) (H T : U → ℝ) (hH : ∀ i, 0 < H i) (hT : ∀ i, 0 < T i) (hsource : ∀ (v : U → ℝ) (b : B → ℝ), b ∈ K → eval (Sum.elim v b) (weightedHomogeneousComponent (Sum.elim (fun _ : U => 1) w) n (jointResidueAffinePolynomial q r D)) = eval (Sum.elim (fun i => v i / T i) (fun j => b j - eval v (majorTranslationTopCoordinates w (fun j => residueAffinePolynomial q r (A j)) j))) S + eval₂ (algebraMap ℚ ℝ) (Sum.elim v b) R) (c C : ℝ) (hc : 1 ≤ c) (hHT : ∀ i, H i ≤ c * (q : ℝ) * T i) (d l : ℕ) (hS : S ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d) (hR : R ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d) (hSmass : realPolynomialMass S ≤ C) (hRgrid : (fun α => R.coeff α) ∈ denominatorGrid l) : ∃ (S' : MvPolynomial (U ⊕ B) ℝ) (R' : MvPolynomial (U ⊕ B) ℚ), S' = majorSlowDilationPullback q H T S ∧ R' = jointRationalPolynomialDilation q R ∧ (∀ (u : U → ℝ) (b : B → ℝ), b ∈ K → eval (Sum.elim u b) (weightedHomogeneousComponent (Sum.elim (fun _ : U => 1) w) n D) = eval (Sum.elim (fun i => u i / H i) (fun j => b j - eval u (majorTranslationTopCoordinates w A j))) S' + eval₂ (algebraMap ℚ ℝ) (Sum.elim u b) R') ∧ realPolynomialMass S' ≤ c^d * C ∧ S' ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d ∧ R' ∈ weightedSupportLE (Sum.elim (fun _ : U => 1) w) d ∧ S'.totalDegree ≤ d ∧ R'.totalDegree ≤ d ∧ (fun α => R'.coeff α) ∈ denominatorGrid (q^d*l) := algebraic_major_weighted_dilation_pullback_decomposition w hw K _ _ S R q hq H T hH hT (algebraic_major_affine_top_dilation_identity K w n D hD A hA S R q r T hsource) c C hc hHT d l hS hR hSmass hRgrid
end Erdos3
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436import OAI.Combinatorics.Progressions.Polynomial.CRTPolynomialInputStepLawimport OAI.Combinatorics.Progressions.Sampling.AllocatedPeriodicGridQuadrature
namespace OAI
section
namespace Erdos3open scoped BigOperators Classical
theorem integerBox_residue_fiberLaw_l1 {I : Type*} [Fintype I] [DecidableEq I] (lo hi : I → ℤ) (hlen : ∀ i, lo i < hi i) (q : ℕ) [NeZero q] (hsmall : (∑ i, (q : ℝ) / ((hi i - lo i : ℤ) : ℝ)) ≤ 1 / 2) : (∑ r : I → ZMod q, |((integerBoxUniformWeights lo hi hlen).fiberLaw (fun x => integerVectorResidue q (fun i => (x i).val))).weight r - (FiniteProbabilityWeights.uniform (I → ZMod q)).weight r|) ≤ 2 * ∑ i, (q : ℝ) / ((hi i - lo i : ℤ) : ℝ) := by let E := 2 * ∑ i, (q : ℝ) / ((hi i - lo i : ℤ) : ℝ) let μ := (integerBoxUniformWeights lo hi hlen).fiberLaw (fun x => integerVectorResidue q (fun i => (x i).val)) let u := FiniteProbabilityWeights.uniform (I → ZMod q) have hc : (0 : ℝ) < (q : ℝ) ^ Fintype.card I := pow_pos (by exact_mod_cast NeZero.pos q) _ have hw (r : I → ZMod q) : |μ.weight r - u.weight r| ≤ E * u.weight r := by have h := integerBox_residue_fiberLaw_relative_error lo hi hlen q r hsmall change |(q : ℝ) ^ Fintype.card I * μ.weight r - 1| ≤ E at h have hu : u.weight r = ((q : ℝ) ^ Fintype.card I)⁻¹ := by simp only [u, FiniteProbabilityWeights.uniform, Fintype.card_fun, ZMod.card, Nat.cast_pow] rw [hu] have heq : μ.weight r - ((q : ℝ) ^ Fintype.card I)⁻¹ = ((q : ℝ) ^ Fintype.card I * μ.weight r - 1) * ((q : ℝ) ^ Fintype.card I)⁻¹ := by field_simp rw [heq, abs_mul, abs_of_pos (inv_pos.mpr hc)] exact mul_le_mul_of_nonneg_right h (inv_nonneg.mpr hc.le) calc _ ≤ ∑ r, E * u.weight r := Finset.sum_le_sum (fun r _ => hw r) _ = E := by rw [← Finset.mul_sum, u.total, mul_one]
theorem integerBox_affine_residue_complexMean_error {I Y : Type*} [Fintype I] [DecidableEq I] (lo hi : I → ℤ) (hlen : ∀ i, lo i < hi i) (q : ℕ) [NeZero q] (origin stride : I → ℤ) (F : (I → ZMod q) → Y) (f : Y → ℂ) (hf : ∀ y, ‖f y‖ ≤ 1) (hsmall : (∑ i, (q : ℝ) / ((hi i - lo i : ℤ) : ℝ)) ≤ 1 / 2) : ‖(integerBoxUniformWeights lo hi hlen).complexMean (fun x => f (F (fun i => ((origin i + stride i * (x i).val : ℤ) : ZMod q)))) - (FiniteProbabilityWeights.uniform (I → ZMod q)).complexMean (fun r => f (F (fun i => (origin i : ZMod q) + (stride i : ZMod q) * r i)))‖ ≤ 2 * ∑ i, (q : ℝ) / ((hi i - lo i : ℤ) : ℝ) := by let μ := (integerBoxUniformWeights lo hi hlen).fiberLaw (fun x => integerVectorResidue q (fun i => (x i).val)) let g := fun r : I → ZMod q => f (F (fun i => (origin i : ZMod q) + (stride i : ZMod q) * r i)) have h := (FiniteProbabilityWeights.norm_complexMean_sub_le_weight_l1 μ (FiniteProbabilityWeights.uniform (I → ZMod q)) g (fun r => hf _)).trans (integerBox_residue_fiberLaw_l1 lo hi hlen q hsmall) dsimp only [μ] at h rw [FiniteProbabilityWeights.fiberLaw_complexMean] at h simpa only [g, integerVectorResidue, Int.cast_add, Int.cast_mul] using h
theorem integerBox_affine_residue_complexMean_error_unconditional {I Y : Type*} [Fintype I] [DecidableEq I] (lo hi : I → ℤ) (hlen : ∀ i, lo i < hi i) (q : ℕ) [NeZero q] (origin stride : I → ℤ) (F : (I → ZMod q) → Y) (f : Y → ℂ) (hf : ∀ y, ‖f y‖ ≤ 1) : ‖(integerBoxUniformWeights lo hi hlen).complexMean (fun x => f (F (fun i => ((origin i + stride i * (x i).val : ℤ) : ZMod q)))) - (FiniteProbabilityWeights.uniform (I → ZMod q)).complexMean (fun r => f (F (fun i => (origin i : ZMod q) + (stride i : ZMod q) * r i)))‖ ≤ 4 * ∑ i, (q : ℝ) / ((hi i - lo i : ℤ) : ℝ) := by by_cases hsmall : (∑ i, (q : ℝ) / ((hi i - lo i : ℤ) : ℝ)) ≤ 1 / 2 · apply (integerBox_affine_residue_complexMean_error lo hi hlen q origin stride F f hf hsmall).trans have hn : 0 ≤ ∑ i, (q : ℝ) / ((hi i - lo i : ℤ) : ℝ) := Finset.sum_nonneg (fun i _ => div_nonneg (Nat.cast_nonneg _) (by exact_mod_cast (sub_pos.mpr (hlen i)).le)) linarith · have h1 := (integerBoxUniformWeights lo hi hlen).norm_complexMean_le_mean_norm (fun x => f (F (fun i => ((origin i + stride i * (x i).val : ℤ) : ZMod q)))) have h2 := (FiniteProbabilityWeights.uniform (I → ZMod q)).norm_complexMean_le_mean_norm (fun r => f (F (fun i => (origin i : ZMod q) + (stride i : ZMod q) * r i))) have hb1 := (integerBoxUniformWeights lo hi hlen).mean_mono (fun x => hf (F (fun i => ((origin i + stride i * (x i).val : ℤ) : ZMod q)))) have hb2 := (FiniteProbabilityWeights.uniform (I → ZMod q)).mean_mono (fun r => hf (F (fun i => (origin i : ZMod q) + (stride i : ZMod q) * r i))) rw [FiniteProbabilityWeights.mean_const] at hb1 hb2 have ht := norm_sub_le ((integerBoxUniformWeights lo hi hlen).complexMean (fun x => f (F (fun i => ((origin i + stride i * (x i).val : ℤ) : ZMod q))))) ((FiniteProbabilityWeights.uniform (I → ZMod q)).complexMean (fun r => f (F (fun i => (origin i : ZMod q) + (stride i : ZMod q) * r i)))) linarith
theorem originalActiveCube_affine_residue_complexMean_error {I Y : Type*} [Fintype I] [DecidableEq I] (L : I → ℕ) (hL : ∀ i, 0 < L i) (q : ℕ) [NeZero q] (origin stride : I → ℤ) (F : (I → ZMod q) → Y) (f : Y → ℂ) (hf : ∀ y, ‖f y‖ ≤ 1) : ‖(FiniteProbabilityWeights.pi (fun i => integerScalarCubeWeights Empty (L i) (hL i))).complexMean (fun x => f (F (fun i => ((origin i + stride i * (x i none : ℤ) : ℤ) : ZMod q)))) - (FiniteProbabilityWeights.uniform (I → ZMod q)).complexMean (fun r => f (F (fun i => (origin i : ZMod q) + (stride i : ZMod q) * r i)))‖ ≤ 4 * ∑ i, (q : ℝ) / L i := by have he := FiniteProbabilityWeights.complexMean_pi_transport_fintype (fun i => integerScalarCubeWeights Empty (L i) (hL i)) (fun i => intervalUniformWeights 0 (L i : ℤ) (by exact_mod_cast hL i)) (fun _ x => (x none : ℤ)) (fun _ x => (x : ℤ)) (fun i g => integerScalarCubeWeights_zero_complexMean Empty (L i) (hL i) g) (fun z : I → ℤ => f (F (fun i => ((origin i + stride i * z i : ℤ) : ZMod q)))) rw [he] simpa only [integerBoxUniformWeights, sub_zero, Int.cast_natCast] using integerBox_affine_residue_complexMean_error_unconditional (fun _ => 0) (fun i => (L i : ℤ)) (fun i => by exact_mod_cast hL i) q origin stride F f hf
end Erdos3
end
section
namespace Erdos3open scoped BigOperators Classicalvariable {L V : Type*} [Fintype L] [Fintype V]local instance activeCRTModulusNeZero (p A : L → ℕ) [∀ l, NeZero (p l)] : NeZero (∏ l, p l ^ A l) := ⟨Finset.prod_ne_zero_iff.mpr (fun l _ => pow_ne_zero _ (NeZero.ne (p l)))⟩
theorem originalActiveCube_crt_input_comparison (length : V → ℕ) (hlength : ∀ v, 0 < length v) (p A e : L → ℕ) [∀ l, NeZero (p l)] (hp : ∀ l, (p l).Prime) (hinj : Function.Injective p) (hq : Pairwise (fun l k => (p l ^ A l).Coprime (p k ^ A k))) (origin : ∀ l, V → ZMod (p l ^ A l)) {q : ℕ} [NeZero q] (hdiv : q ∣ ∏ l, p l ^ A l) (f : (V → ZMod q) → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) : let c : V → ℤ := fun v => (crtInput (fun l => p l ^ A l) hq origin v).val let step : ℤ := (∏ l, p l ^ e l : ℕ) ‖(FiniteProbabilityWeights.pi (fun v => integerScalarCubeWeights Empty (length v) (hlength v))).complexMean (fun x => f (fun v => ((c v + step * (x v none : ℤ) : ℤ) : ZMod q))) - (crtPolynomialInputLaw p A e hq origin).complexMean (fun x => f (tupleResidueReduction hdiv x))‖ ≤ 4 * ∑ v, (q : ℝ) / length v := by intro c step rw [crtPolynomialInputLaw_divisor_integerOrigin_complexMean p A e hp hinj hq origin hdiv f] simpa only [c, step, Int.cast_natCast, id_eq] using originalActiveCube_affine_residue_complexMean_error length hlength q c (fun _ => step) id f hf
theorem crtPolynomialInputLaw_unrestricted_divisor_complexMean (p A : L → ℕ) [∀ l, NeZero (p l)] (hp : ∀ l, (p l).Prime) (hinj : Function.Injective p) (hq : Pairwise (fun l k => (p l ^ A l).Coprime (p k ^ A k))) (origin : ∀ l, V → ZMod (p l ^ A l)) {q : ℕ} [NeZero q] (hdiv : q ∣ ∏ l, p l ^ A l) (f : (V → ZMod q) → ℂ) : (crtPolynomialInputLaw p A (fun _ => 0) hq origin).complexMean (fun x => f (tupleResidueReduction hdiv x)) = (FiniteProbabilityWeights.uniform (V → ZMod q)).complexMean f := by rw [crtPolynomialInputLaw_divisor_complexMean p A (fun _ => 0) hp hinj hq origin hdiv f] simp only [pow_zero, Finset.prod_const_one, Nat.cast_one, one_mul] rw [FiniteProbabilityWeights.uniform_complexMean, FiniteProbabilityWeights.uniform_complexMean] exact Fintype.expect_equiv (Equiv.addLeft (tupleResidueReduction hdiv (crtInput (fun l => p l ^ A l) hq origin))) _ _ (fun _ => rfl)
theorem originalActiveCube_crt_unrestricted_input_comparison (length : V → ℕ) (hlength : ∀ v, 0 < length v) (p A : L → ℕ) [∀ l, NeZero (p l)] (hp : ∀ l, (p l).Prime) (hinj : Function.Injective p) (hq : Pairwise (fun l k => (p l ^ A l).Coprime (p k ^ A k))) (origin : ∀ l, V → ZMod (p l ^ A l)) {q : ℕ} [NeZero q] (hdiv : q ∣ ∏ l, p l ^ A l) (f : (V → ZMod q) → ℂ) (hf : ∀ x, ‖f x‖ ≤ 1) : ‖(FiniteProbabilityWeights.pi (fun v => integerScalarCubeWeights Empty (length v) (hlength v))).complexMean (fun x => f (fun v => ((x v none : ℤ) : ZMod q))) - (crtPolynomialInputLaw p A (fun _ => 0) hq origin).complexMean (fun x => f (tupleResidueReduction hdiv x))‖ ≤ 4 * ∑ v, (q : ℝ) / length v := by rw [crtPolynomialInputLaw_unrestricted_divisor_complexMean p A hp hinj hq origin hdiv f] simpa only [zero_add, one_mul, Int.cast_one, Int.cast_zero, id_eq] using originalActiveCube_affine_residue_complexMean_error length hlength q (fun _ => 0) (fun _ => 1) id f hf
end Erdos3
end
section
namespace Erdos3
open scoped BigOperators Classical
variable {L A I J : Type*} [Fintype L] [Fintype A] [Fintype J] [DecidableEq J]
local instance unrestrictedForecastModulusNeZero (p e : L → ℕ) [∀ l, NeZero (p l)] : NeZero (∏ l, p l ^ e l) := ⟨Finset.prod_ne_zero_iff.mpr (fun l _ => pow_ne_zero _ (NeZero.ne (p l)))⟩
theorem rationalPolynomialForecast_unrestrictedCRT_marginal (p e : L → ℕ) [∀ l, NeZero (p l)] (hp : ∀ l, (p l).Prime) (hinj : Function.Injective p) (hcoprime : Pairwise (fun l k => (p l ^ e l).Coprime (p k ^ e k))) (origin : ∀ l, A → ZMod (p l ^ e l)) (poly : J → MvPolynomial (A ⊕ I) ℤ) (inactive : I → ℤ) {q : ℕ} [NeZero q] (hdiv : q ∣ ∏ l, p l ^ e l) (test : (J → ZMod q) → ℂ) : (𝔼 b : J → ZMod (∏ l, p l ^ e l), (rationalOutputDensity (crtPolynomialInputLaw p e (fun _ => 0) hcoprime origin) (integerLongPolynomialOutput poly inactive (∏ l, p l ^ e l)) (∏ l, p l ^ e l) b : ℂ) * test (fun j => ZMod.castHom hdiv (ZMod q) (b j))) = 𝔼 t : A → ZMod q, test (fun j => MvPolynomial.eval₂ (Int.castRingHom (ZMod q)) (Sum.elim t (fun i => (inactive i : ZMod q))) (poly j)) := by rw [rationalOutputDensity_divisor_test _ _ hdiv] simp_rw [integerLongPolynomialOutput_reduce poly inactive hdiv] exact (crtPolynomialInputLaw_unrestricted_divisor_complexMean p e hp hinj hcoprime origin hdiv (fun t => test (fun j => MvPolynomial.eval₂ (Int.castRingHom (ZMod q)) (Sum.elim t (fun i => (inactive i : ZMod q))) (poly j)))).trans (FiniteProbabilityWeights.uniform_complexMean _)
theorem rationalInactivePolynomialForecast_conditionalUnrestrictedCRT_tsum_marginal {Ω Z : Type*} [Fintype Ω] (inactive : FiniteProbabilityWeights Ω) (gridPoint : Ω → Z) (p e : L → ℕ) [∀ l, NeZero (p l)] (hp : ∀ l, (p l).Prime) (hinj : Function.Injective p) (hcoprime : Pairwise (fun l k => (p l ^ e l).Coprime (p k ^ e k))) (origin : Ω → ∀ l, A → ZMod (p l ^ e l)) (poly : J → MvPolynomial (A ⊕ I) ℤ) (inactiveCoord : Ω → I → ℤ) {q : ℕ} [NeZero q] (hdiv : q ∣ ∏ l, p l ^ e l) {gridVolume : ℝ} (hV : gridVolume ≠ 0) (test : Z → (J → ZMod q) → ℂ) : (∑' z, 𝔼 b : J → ZMod (∏ l, p l ^ e l), ((rationalInactiveForecast inactive (fun i => crtPolynomialInputLaw p e (fun _ => 0) hcoprime (origin i)) gridPoint (fun i => integerLongPolynomialOutput poly (inactiveCoord i) (∏ l, p l ^ e l)) (∏ l, p l ^ e l) gridVolume z b / gridVolume : ℝ) : ℂ) * test z (fun j => ZMod.castHom hdiv (ZMod q) (b j))) = inactive.complexMean (fun i => 𝔼 t : A → ZMod q, test (gridPoint i) (fun j => MvPolynomial.eval₂ (Int.castRingHom (ZMod q)) (Sum.elim t (fun a => (inactiveCoord i a : ZMod q))) (poly j))) := by rw [rationalInactiveForecast_divisor_tsum_test _ _ _ _ hdiv hV] congr 1 funext i simp_rw [integerLongPolynomialOutput_reduce poly (inactiveCoord i) hdiv] exact (crtPolynomialInputLaw_unrestricted_divisor_complexMean p e hp hinj hcoprime (origin i) hdiv (fun t => test (gridPoint i) (fun j => MvPolynomial.eval₂ (Int.castRingHom (ZMod q)) (Sum.elim t (fun a => (inactiveCoord i a : ZMod q))) (poly j)))).trans (FiniteProbabilityWeights.uniform_complexMean _)
theorem rationalInactivePolynomialForecast_unrestrictedCRT_tsum_marginal {Ω Z : Type*} [Fintype Ω] (inactive : FiniteProbabilityWeights Ω) (gridPoint : Ω → Z) (p e : L → ℕ) [∀ l, NeZero (p l)] (hp : ∀ l, (p l).Prime) (hinj : Function.Injective p) (hcoprime : Pairwise (fun l k => (p l ^ e l).Coprime (p k ^ e k))) (origin : ∀ l, A → ZMod (p l ^ e l)) (poly : J → MvPolynomial (A ⊕ I) ℤ) (inactiveCoord : Ω → I → ℤ) {q : ℕ} [NeZero q] (hdiv : q ∣ ∏ l, p l ^ e l) {gridVolume : ℝ} (hV : gridVolume ≠ 0) (test : Z → (J → ZMod q) → ℂ) : (∑' z, 𝔼 b : J → ZMod (∏ l, p l ^ e l), ((rationalInactiveForecast inactive (fun _ => crtPolynomialInputLaw p e (fun _ => 0) hcoprime origin) gridPoint (fun i => integerLongPolynomialOutput poly (inactiveCoord i) (∏ l, p l ^ e l)) (∏ l, p l ^ e l) gridVolume z b / gridVolume : ℝ) : ℂ) * test z (fun j => ZMod.castHom hdiv (ZMod q) (b j))) = inactive.complexMean (fun i => 𝔼 t : A → ZMod q, test (gridPoint i) (fun j => MvPolynomial.eval₂ (Int.castRingHom (ZMod q)) (Sum.elim t (fun a => (inactiveCoord i a : ZMod q))) (poly j))) := rationalInactivePolynomialForecast_conditionalUnrestrictedCRT_tsum_marginal inactive gridPoint p e hp hinj hcoprime (fun _ => origin) poly inactiveCoord hdiv hV test
end Erdos3
end
section
namespace Erdos3.VectorPolynomial
open scoped BigOperators Classical
variable {m : ℕ} {G : Type*} [Fintype G]variable {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ}variable (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)]variable {J : Fin m → Type*} [∀ j, Fintype (J j)]variable (U : ∀ j, Submodule ℝ (J j → ℝ))variable (basis : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ)variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U basis R σ)
local notation "degree" => layerSamplerDegree I nlocal notation "short" => allocatedShortAxis (I := I) U basis S.valuelocal notation "sides" => allocatedPrincipalSides B U basis Slocal notation "hSides" => allocatedPrincipalSides_pos B U basis Slocal notation "Active" => {a : LayerSamplerAxis I n // ¬short a}local notation "activeB" => (fun a : Active => B (Subtype.val a))local notation "activeDegree" => (fun a : Active => degree (Subtype.val a))local notation "ActiveInput" => PrincipalTupleIndex activeB activeDegreelocal notation "activeLength" => principalAxisLength (fun a => ¬short a) sideslocal notation "activePos" => (fun j : ActiveInput => hSides (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j)))local notation "Original" => PrincipalIntegerTuples B degree Empty sides
variable (q : ℕ)variable (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option Empty → ZMod q)variable (hcell : 0 < (principalTupleWeights (α := Empty) B (layerSamplerDegree I n) (allocatedPrincipalSides B U basis S) (allocatedPrincipalSides_pos B U basis S)).mass (Finset.univ.filter (fun y => principalResidueLabel q y = r)))
noncomputable def allocatedShortPrincipalResidueLaw := principalSupportedAxisWeights B degree sides hSides q r hcell short
noncomputable def allocatedActivePrincipalResidueLaw := principalSupportedAxisWeights B degree sides hSides q r hcell (fun a => ¬short a)
theorem allocatedPrincipalResidue_partition (f : Original → ℂ) : ((principalTupleWeights (α := Empty) B degree sides hSides).condition (Finset.univ.filter (fun y => principalResidueLabel q y = r)) hcell).complexMean f = (allocatedShortPrincipalResidueLaw B U basis S q r hcell).complexMean (fun u => (allocatedActivePrincipalResidueLaw B U basis S q r hcell).complexMean (fun v => f (principalAxisJoin short u v))) := principalSupportedResidueWeights_partition B degree sides hSides q r hcell short f
theorem allocatedActivePrincipalResidue_length (j : ActiveInput) : activeLength j = S.value := allocatedPrincipalSides_long_of_not_short B U basis S j.1.val j.1.property j.2.1 j.2.2
theorem allocatedActivePrincipalResidueLaw_eq (hq : 0 < q) (hsize : q ≤ S.value) : allocatedActivePrincipalResidueLaw B U basis S q r hcell = principalResidueWeights activeB activeDegree activeLength activePos q hq (fun j => r ⟨j.1.val, j.2⟩) (fun j => by simpa only [Fintype.card_empty, zero_add, one_mul, allocatedActivePrincipalResidue_length B U basis S] using hsize) := by exact principalSupportedAxisWeights_eq_residueWeights B degree sides hSides q r hcell (fun a => ¬short a) hq _
theorem allocatedPrincipalResidue_partition_mul (φ : PrincipalAxisTuples (α := Empty) short sides → ℂ) (ψ : PrincipalAxisTuples (α := Empty) (fun a => ¬short a) sides → ℂ) : ((principalTupleWeights (α := Empty) B degree sides hSides).condition (Finset.univ.filter (fun y => principalResidueLabel q y = r)) hcell).complexMean (fun y => φ (principalAxisRestrict short y) * ψ (principalAxisRestrict (fun a => ¬short a) y)) = (allocatedShortPrincipalResidueLaw B U basis S q r hcell).complexMean φ * (allocatedActivePrincipalResidueLaw B U basis S q r hcell).complexMean ψ := principalSupportedResidueWeights_partition_mul B degree sides hSides q r hcell short φ ψ
private theorem scalarResidueIntegerMean_congr (L₁ L₂ q : ℕ) (hL₁ : 0 < L₁) (hL₂ : 0 < L₂) (hq : 0 < q) (r : Option Empty → ZMod q) (hsize₁ : (Fintype.card Empty + 1) * q ≤ L₁) (hsize₂ : (Fintype.card Empty + 1) * q ≤ L₂) (he : L₁ = L₂) (f : ℤ → ℂ) : (scalarCubeResidueWeights Empty L₁ q hL₁ (fun _ => q) r (fun _ => hq) (fun _ => le_rfl) hsize₁).complexMean (fun z => f (z none : ℤ)) = (scalarCubeResidueWeights Empty L₂ q hL₂ (fun _ => q) r (fun _ => hq) (fun _ => le_rfl) hsize₂).complexMean (fun z => f (z none : ℤ)) := by subst L₂ rfl
theorem allocatedActivePrincipalResidueLaw_integer_mean (hq : 0 < q) (hsize : q ≤ S.value) (f : (ActiveInput → ℤ) → ℂ) : (allocatedActivePrincipalResidueLaw B U basis S q r hcell).complexMean (fun y => f (fun j => (y j none : ℤ))) = (principalResidueWeights activeB activeDegree (fun _ => S.value) (fun _ => S.positive) q hq (fun j => r ⟨j.1.val, j.2⟩) (fun _ => by simpa only [Fintype.card_empty, zero_add, one_mul] using hsize)).complexMean (fun y => f (fun j => (y j none : ℤ))) := by rw [allocatedActivePrincipalResidueLaw_eq B U basis S q r hcell hq hsize] exact FiniteProbabilityWeights.complexMean_pi_transport_fintype (fun j => scalarCubeResidueWeights Empty (activeLength j) q (activePos j) (fun _ => q) (r ⟨j.1.val, j.2⟩) (fun _ => hq) (fun _ => le_rfl) (by simpa only [Fintype.card_empty, zero_add, one_mul, allocatedActivePrincipalResidue_length B U basis S] using hsize)) (fun j => scalarCubeResidueWeights Empty S.value q S.positive (fun _ => q) (r ⟨j.1.val, j.2⟩) (fun _ => hq) (fun _ => le_rfl) (by simpa only [Fintype.card_empty, zero_add, one_mul] using hsize)) (fun _ z => (z none : ℤ)) (fun _ z => (z none : ℤ)) (fun j g => scalarResidueIntegerMean_congr (activeLength j) S.value q (activePos j) S.positive hq (r ⟨j.1.val, j.2⟩) _ _ (allocatedActivePrincipalResidue_length B U basis S j) g) f
theorem allocatedPrincipalResidue_integer_partition (hq : 0 < q) (hsize : q ≤ S.value) (f : PrincipalAxisTuples (α := Empty) short sides → (ActiveInput → ℤ) → ℂ) : ((principalTupleWeights (α := Empty) B degree sides hSides).condition (Finset.univ.filter (fun y => principalResidueLabel q y = r)) hcell).complexMean (fun y => f (principalAxisRestrict short y) (fun j => ((principalAxisRestrict (fun a => ¬short a) y) j none : ℤ))) = (allocatedShortPrincipalResidueLaw B U basis S q r hcell).complexMean (fun u => (principalResidueWeights activeB activeDegree (fun _ => S.value) (fun _ => S.positive) q hq (fun j => r ⟨j.1.val, j.2⟩) (fun _ => by simpa only [Fintype.card_empty, zero_add, one_mul] using hsize)).complexMean (fun v => f u (fun j => (v j none : ℤ)))) := by rw [allocatedPrincipalResidue_partition B U basis S q r hcell] simp only [principalAxisRestrict_join_left, principalAxisRestrict_join_right] congr 1 funext u exact allocatedActivePrincipalResidueLaw_integer_mean B U basis S q r hcell hq hsize (f u)
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomialopen scoped BigOperators Classicalvariable {m : ℕ} {G : Type*} [Fintype G]variable {I : Fin m → Type*} [∀ j, Fintype (I j)] {n : Fin m → ℕ}variable (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)]variable {J : Fin m → Type*} [∀ j, Fintype (J j)]variable (U : ∀ j, Submodule ℝ (J j → ℝ))variable (basis : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ)variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U basis R σ)local notation "short" => allocatedShortAxis (I := I) U basis S.valuelocal notation "Active" => {a : LayerSamplerAxis I n // ¬short a}local notation "AB" => (fun a : Active => B (Subtype.val a))local notation "Ah" => (fun a : Active => layerSamplerDegree I n (Subtype.val a))local notation "AI" => PrincipalTupleIndex AB Ahlocal notation "L" => principalAxisLength (fun a => ¬short a) (allocatedPrincipalSides B U basis S)local notation "hL" => (fun j : AI => allocatedPrincipalSides_pos B U basis S (Sigma.mk (Subtype.val (Sigma.fst j)) (Sigma.snd j)))
theorem allocatedActive_affine_residue_comparison {Y : Type*} (q : ℕ) [NeZero q] (origin stride : AI → ℤ) (F : (AI → ZMod q) → Y) (f : Y → ℂ) (hf : ∀ y, ‖f y‖ ≤ 1) : ‖(principalTupleWeights (α := Empty) AB Ah L hL).complexMean (fun x => f (F (fun i => ((origin i + stride i * (x i none : ℤ) : ℤ) : ZMod q)))) - (FiniteProbabilityWeights.uniform (AI → ZMod q)).complexMean (fun r => f (F (fun i => (origin i : ZMod q) + (stride i : ZMod q) * r i)))‖ ≤ 4 * Fintype.card AI * ((q : ℝ) / S.value) := by classical have he := originalActiveCube_affine_residue_complexMean_error L hL q origin stride F f hf have hs : (∑ i : AI, (q : ℝ) / L i) = Fintype.card AI * ((q : ℝ) / S.value) := by simp only [allocatedActivePrincipalResidue_length B U basis S, Finset.sum_const, Finset.card_univ, nsmul_eq_mul] rw [hs] at he exact he.trans_eq (by ring)
end Erdos3.VectorPolynomial
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104import OAI.Combinatorics.Progressions.Fourier.AllocatedSupportedResidueSpectrum
namespace OAI
section
namespace Erdos3.VectorPolynomial
open scoped BigOperators Classical NNReal
variable {m : ℕ} {G : Type*} [Fintype G]variable {I : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, DecidableEq (I j)]variable {n : Fin m → ℕ} (B : LayerSamplerAxis I n → Type*)variable [∀ a, Fintype (B a)] [∀ a, DecidableEq (B a)]variable {J : Fin m → Type*} [∀ j, Fintype (J j)]variable (U : ∀ j, Submodule ℝ (J j → ℝ))variable (basis : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ)variable {R σ : Fin m → ℝ} (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j)variable (S : LayerSamplerScale (G := G) B U basis R σ)variable {α : Type*} [Fintype α] [DecidableEq α]variable (q : ℕ) (r : PrincipalTupleIndex B (layerSamplerDegree I n) → Option α → ZMod q)variable (hcell : 0 < (principalTupleWeights (α := α) B (layerSamplerDegree I n) (allocatedPrincipalSides B U basis S) (allocatedPrincipalSides_pos B U basis S)).mass (Finset.univ.filter (fun y => principalResidueLabel q y = r)))variable (j : Fin m) (i : Fin (n j))
variable (hactive : S.value ^ (j.val + 1) < basisAxisScale (basis j) i)variable (hq : 0 < q) (hsize : (Fintype.card α + 1) * q ≤ S.value)
local notation "sources" => allocatedActiveResidueSources B U basis S j i hactive q hq r hsizelocal notation "csource" => allocatedPrincipalNormalizedSource B U basis hR S j i hactivelocal notation "gamma" => principalProfileSize (R j) (Finset.card (layerIntegerPrincipalSlots (G := G) B j i))local notation "torus" => blockTorusFactor (Fintype.card α) (j.val + 1) (Fintype.card (B (Sigma.mk j (Sum.inr i)))) (4 * gamma)
omit [∀ j, DecidableEq (I j)] [∀ a, DecidableEq (B a)] innoncomputable def allocatedActiveResiduePointApproximation (M : ℕ) [NeZero M] (rows : Finset (Finset α)) (shift z : rows → ℤ) (F : Finset (rows → Fin M)) : ℂ := if ∀ t, |(z t : ℝ) - shift t| ≤ blockJetScaleBound (Fintype.card α) (j.val + 1) (Fintype.card (B ⟨j, Sum.inr i⟩)) (4 * gamma) * basisAxisScale (basis j) i then weightedModerateGridApproximation (fun _ : B ⟨j, Sum.inr i⟩ => csource) sources (basisAxisScale (basis j) i) M rows (fun _ => 0) shift z F else 0
theorem allocatedActiveResiduePointMass_error_of_tail {M : ℕ} [NeZero M] (hM : M = torus * basisAxisScale (basis j) i) (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ j.val + 1) (shift z : rows → ℤ) (F : Finset (rows → Fin M)) {ε : ℝ} (hε : 0 ≤ ε) (htail : spectrumTail F (fun k => ‖∏ b : B ⟨j, Sum.inr i⟩, weightedModerateGridCoefficient csource ((sources) b) 0 M rows k‖) ≤ ε) : ‖(((basisAxisScale (basis j) i : ℝ) ^ rows.card * (allocatedSupportedResidueJetPMF B U basis hR hσ S q r hcell j i rows shift z).toReal : ℝ) : ℂ) - allocatedActiveResiduePointApproximation B U basis hR S q r j i hactive hq hsize M rows shift z F‖ ≤ ε := by have hgamma : 0 < gamma := principalProfileSize_pos (hR j) _ exact weightedModeratePointMass_error_cutoff (fun _ : B ⟨j, Sum.inr i⟩ => csource) sources (fun _ => 0) (by positivity) (basisAxisScale_pos (basis j) i) (allocatedActiveResidueSources_volume B U basis S j i hactive q hq r hsize hR) hM rows hrows shift z (allocatedSupportedResidueJetPMF B U basis hR hσ S q r hcell j i rows shift) (allocatedSupportedResidueJetPMF_source B U basis hR hσ S q r hcell j i hactive hq hsize rows shift) F hε (by simp only [Int.cast_zero] exact htail)
theorem allocatedActiveResiduePointMass_error_of_grid (hgrid : allocatedGridAxis (I := I) U basis S.value ⟨j, Sum.inr i⟩) (A : ℝ≥0) (hA : LipschitzWith A Real.smoothTransition) (P : ℝ) (hcP : scalarCubePrimitiveEnvelope Empty A 16 (128 * probabilityProfileLipschitz) 1 ≤ P) (hsP : scalarCubePrimitiveEnvelope α A 1 0 q ≤ P) {ζ ε : ℝ} {M : ℕ} [NeZero M] (hM : M = torus * basisAxisScale (basis j) i) (hζ : 0 < ζ) (hζ1 : ζ ≤ 1) (hε : 0 ≤ ε) (rows : Finset (Finset α)) (hrows : ∀ t ∈ rows, t.card ≤ j.val + 1) (hB : positiveModerateSpectrumBlockCount j.val rows.card ((layerTailDegree m + 1) * rows.card) ≤ Fintype.card (B ⟨j, Sum.inr i⟩)) (haccuracy : (2 * positiveModerateSpectrumConstant j.val rows.card P ((torus : ℝ) / (2 * gamma)) * 2 ^ positiveModerateSpectrumExponent j.val rows.card + (torus : ℝ) ^ rows.card * (2 ^ positiveModerateLengthExponent j.val * positiveModerateLengthConstant j.val P) ^ ((layerTailDegree m + 1) * rows.card)) * ζ ≤ ε) (shift z : rows → ℤ) : ‖(((basisAxisScale (basis j) i : ℝ) ^ rows.card * (allocatedSupportedResidueJetPMF B U basis hR hσ S q r hcell j i rows shift z).toReal : ℝ) : ℂ) - allocatedActiveResiduePointApproximation B U basis hR S q r j i hactive hq hsize M rows shift z (positiveModerateSpectrumCover rows M j.val P ((torus : ℝ) / (2 * gamma)) S.value ζ)‖ ≤ ε := by have hMK : (M : ℝ) ≤ (torus : ℝ) * basisAxisScale (basis j) i := by simp only [hM, Nat.cast_mul, le_refl] apply allocatedActiveResiduePointMass_error_of_tail B U basis hR hσ S q r hcell j i hactive hq hsize hM rows hrows shift z _ hε exact allocatedActiveResidueSpectrum_tail B U basis S j i hactive q hq r hsize hR A hA P hcP hsP (Nat.cast_nonneg torus) (pow_nonneg (Nat.cast_nonneg torus) _) hζ hζ1 hε (Nat.pos_of_ne_zero (NeZero.ne M)) hMK rows hrows hB (allocatedGrid_modulus_cardinality B U basis S j i hgrid (Nat.cast_nonneg torus) hMK rows.card) haccuracy
end Erdos3.VectorPolynomial
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586import OAI.Combinatorics.Progressions.Estimates.AllocatedActualRationalMarginal
namespace OAI
section
namespace Erdos3.VectorPolynomial
open MeasureTheoryopen scoped BigOperators Classical
variable {m : ℕ} {G X : Type*} [Fintype G] [Fintype X]variable {I E : Fin m → Type*} [∀ j, Fintype (I j)] [∀ j, Fintype (E j)] {n : Fin m → ℕ}variable (B : LayerSamplerAxis I n → Type*) [∀ a, Fintype (B a)]variable {J : Fin m → Type*} [∀ j, Fintype (J j)]variable (U : ∀ j, Submodule ℝ (J j → ℝ))variable (basis : ∀ j, Module.Basis (Fin (n j)) ℝ (euclideanSubspace (U j))ᗮ)variable {R σ : Fin m → ℝ} (S : LayerSamplerScale (G := G) B U basis R σ)
local notation "short" => allocatedShortAxis (I := I) U basis S.valuelocal notation "degree" => layerSamplerDegree I nlocal notation "sides" => allocatedPrincipalSides B U basis Slocal notation "hSides" => allocatedPrincipalSides_pos B U basis Slocal notation "ShortTuple" => PrincipalAxisTuples (α := Empty) short sideslocal notation "Long" => LayerSamplerLongVariables short G Blocal notation "Out" => Sigma (AllocatedCongruenceRankOutput X E short)local notation "law" => principalTupleWeights (α := Empty) B degree sides hSides
variable {PrimeIndex : Type*} [Fintype PrimeIndex]variable (primes exponent : PrimeIndex → ℕ) [∀ l, NeZero (primes l)]local notation "N" => (∏ l, primes l ^ exponent l)local instance actualCRTModulusNeZero : NeZero N := ⟨Finset.prod_ne_zero_iff.mpr (fun l _ => pow_ne_zero _ (NeZero.ne (primes l)))⟩
theorem allocatedActual_crtRationalForecast_tsum_marginal (hR : ∀ j, 0 < R j) (hσ : ∀ j, 0 < σ j) {A : Type*} (selected : A → Σ j : Fin m, Fin (n j)) (hsmall : ∀ a, basisAxisScale (basis (selected a).1) (selected a).2 ≤ S.value ^ ((selected a).1.val + 1)) (c : ∀ a, BoundedCoefficientExponent (LayerSamplerVariables G I n B) ((selected a).1.val + 1) → ℤ) (hc : ∀ a d, c a d ∈ (allocatedLayerIntegerPMFs B U basis hR hσ S (selected a).1 (selected a).2 d).support) (x : G → IntegerScalarCubeBox Empty S.value) (base : X → ℤ) (noise : Option (LayerSamplerVariables G I n B) × X → ℤ) (deck : ∀ j : Fin m, BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1) → E j → ℤ) (projection : ∀ j, AllocatedDegreeActiveAxis short j → BoundedCoefficientExponent (LayerSamplerVariables G I n B) (j.val + 1) → ℤ) (hp : ∀ l, (primes l).Prime) (hinj : Function.Injective primes) (hcoprime : Pairwise (fun l k => (primes l ^ exponent l).Coprime (primes k ^ exponent k))) (origin : ∀ l, Long → ZMod (primes l ^ exponent l)) {q : ℕ} [NeZero q] (hq : q ∣ N) {gridVolume : ℝ} (hV : gridVolume ≠ 0) (test : (A → ((Finset.univ : Finset (Finset Empty)) : Type) → ℤ) → (Out → ZMod q) → ℂ) : let poly := allocatedForecastPolynomial short base noise deck projection (∑' z, 𝔼 b : Out → ZMod N, ((rationalInactiveForecast (law) (fun _ => crtPolynomialInputLaw primes exponent (fun _ => 0) hcoprime origin) (forecastInactiveFixedOutput B U basis S selected c x) (fun v => integerLongPolynomialOutput poly (fun k => (v k.1 k.2 : ℤ)) N) N gridVolume z b / gridVolume : ℝ) : ℂ) * test z (fun j => ZMod.castHom hq (ZMod q) (b j))) = (allocatedUnconditionalShortPrincipalLaw B U basis S).complexMean (fun u => 𝔼 t : Long → ZMod q, test (forecastInactiveShortGrid B U basis S selected c u) (fun o => MvPolynomial.eval₂ (Int.castRingHom (ZMod q)) (Sum.elim t (fun k => (allocatedShortPrincipalRaw B U basis S u k : ZMod q))) (poly o))) := by intro poly have hcrt := rationalInactivePolynomialForecast_unrestrictedCRT_tsum_marginal (law) (forecastInactiveFixedOutput B U basis S selected c x) primes exponent hp hinj hcoprime origin poly (fun v k => (v k.1 k.2 : ℤ)) hq hV test have huniform := rationalInactivePolynomialForecast_tsum_marginal (law) (forecastInactiveFixedOutput B U basis S selected c x) poly (fun v k => (v k.1 k.2 : ℤ)) hq hV test exact hcrt.trans (huniform.symm.trans (allocatedActual_rationalForecast_tsum_marginal B U basis S hR hσ selected hsmall c hc x base noise deck projection hq hV test))
end Erdos3.VectorPolynomial
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325import OAI.Combinatorics.Progressions.Dynamics.AllocatedFiniteIdealMaskBudgetimport OAI.Combinatorics.Progressions.Sampling.AllocatedSlicedGridResourceBudget
namespace OAI
section
namespace Erdos3.VectorPolynomial
open scoped NNReal
theorem allocatedAffineFactor_exp_bound {B Q Op Pper cutoff coord Qgrid Mp period r radius : ℝ} (axes gridaxes : ℕ) (hB : 0 ≤ B) (hQ : 0 ≤ Q) (hOp : 0 ≤ Op) (hPper : 0 ≤ Pper) (ha : (axes : ℝ) ≤ B) (hg : (gridaxes : ℝ) ≤ B) (hc0 : 0 ≤ cutoff) (hcoord0 : 0 ≤ coord) (hgrid0 : 0 ≤ Qgrid) (hMp0 : 0 ≤ Mp) (hper0 : 0 ≤ period) (hc : cutoff ≤ Real.exp B) (hcoord : coord ≤ Real.exp B) (hQgrid : Qgrid ≤ Real.exp B) (hMp : Mp ≤ Real.exp Pper) (hper : period ≤ Real.exp Pper) (hr : 1 ≤ r) (hradius : 1 ≤ radius) : let Llong := (axes * cutoff / (2 * r)) * coord + max ((Real.exp (axes + 6 * Q + 12) + axes * cutoff / (2 * radius)) * coord * Mp) (4 * Mp) let Lgrid := max (gridaxes * Real.exp Op * Qgrid * coord * (Real.exp Op) ^ gridaxes) (4 * (Real.exp Op) ^ gridaxes) (Llong + Lgrid) * (period * (Real.exp Op) ^ gridaxes) ≤ Real.exp (10 * B + 6 * Q + 2 * Pper + (2 * B + 1) * Op + 19) := by intro Llong Lgrid have hax : (axes : ℝ) ≤ Real.exp B := ha.trans (by linarith [Real.add_one_le_exp B]) have hgx : (gridaxes : ℝ) ≤ Real.exp B := hg.trans (by linarith [Real.add_one_le_exp B]) have hcut (z : ℝ) (hz : 1 ≤ z) : (axes : ℝ) * cutoff / (2 * z) ≤ Real.exp (2 * B) := by calc _ ≤ (axes : ℝ) * cutoff := div_le_self (mul_nonneg (Nat.cast_nonneg _) hc0) (by linarith) _ ≤ Real.exp B * Real.exp B := mul_le_mul hax hc hc0 (Real.exp_nonneg _) _ = _ := by rw [← Real.exp_add, ← two_mul] have hfirst : (axes * cutoff / (2 * r)) * coord ≤ Real.exp (3 * B) := by calc _ ≤ Real.exp (2 * B) * Real.exp B := mul_le_mul (hcut r hr) hcoord hcoord0 (Real.exp_nonneg _) _ = _ := by rw [← Real.exp_add]; congr 1; ring have hsum : Real.exp (axes + 6 * Q + 12) + axes * cutoff / (2 * radius) ≤ Real.exp (3 * B + 6 * Q + 13) := by have hs := add_le_exp_add_one (show 0 ≤ B + 6 * Q + 12 by positivity) (show 0 ≤ 2 * B by positivity) (Real.exp_le_exp.mpr (add_le_add (add_le_add ha le_rfl) le_rfl)) (hcut radius hradius) exact hs.trans_eq (by congr 1; ring) have hsecond : (Real.exp (axes + 6 * Q + 12) + axes * cutoff / (2 * radius)) * coord * Mp ≤ Real.exp (4 * B + 6 * Q + Pper + 13) := by calc _ ≤ Real.exp (3 * B + 6 * Q + 13) * Real.exp B * Real.exp Pper := mul_le_mul (mul_le_mul hsum hcoord hcoord0 (Real.exp_nonneg _)) hMp hMp0 (by positivity) _ = _ := by rw [← Real.exp_add, ← Real.exp_add]; congr 1; ring have hfour : (4 : ℝ) ≤ Real.exp 4 := by linarith [Real.add_one_le_exp (4 : ℝ)] have hthird : 4 * Mp ≤ Real.exp (4 * B + 6 * Q + Pper + 13) := by calc _ ≤ Real.exp 4 * Real.exp Pper := mul_le_mul hfour hMp hMp0 (Real.exp_nonneg _) _ = Real.exp (4 + Pper) := (Real.exp_add _ _).symm _ ≤ _ := Real.exp_le_exp.mpr (by linarith) have hlong : Llong ≤ Real.exp (7 * B + 6 * Q + Pper + 14) := by have h := add_le_exp_add_one (show 0 ≤ 3 * B by positivity) (show 0 ≤ 4 * B + 6 * Q + Pper + 13 by positivity) hfirst (max_le hsecond hthird) exact h.trans_eq (by congr 1; ring) have hpower : (Real.exp Op) ^ gridaxes ≤ Real.exp (B * Op) := by rw [← Real.exp_nat_mul] exact Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_right hg hOp) have hgridFirst : gridaxes * Real.exp Op * Qgrid * coord * (Real.exp Op) ^ gridaxes ≤ Real.exp (3 * B + (B + 1) * Op) := by calc _ ≤ Real.exp B * Real.exp Op * Real.exp B * Real.exp B * Real.exp (B * Op) := by gcongr _ = _ := by simp only [← Real.exp_add]; congr 1; ring have hgrid : Lgrid ≤ Real.exp (3 * B + (B + 1) * Op + 4) := by apply max_le · exact hgridFirst.trans (Real.exp_le_exp.mpr (by linarith)) · calc _ ≤ Real.exp 4 * Real.exp (B * Op) := mul_le_mul hfour hpower (by positivity) (Real.exp_nonneg _) _ = Real.exp (4 + B * Op) := (Real.exp_add _ _).symm _ ≤ _ := Real.exp_le_exp.mpr (by nlinarith) have hboth := add_le_exp_add_one (show 0 ≤ 7 * B + 6 * Q + Pper + 14 by positivity) (show 0 ≤ 3 * B + (B + 1) * Op + 4 by positivity) hlong hgrid have hcover : period * (Real.exp Op) ^ gridaxes ≤ Real.exp (Pper + B * Op) := (mul_le_mul hper hpower (by positivity) (Real.exp_nonneg _)).trans_eq (Real.exp_add _ _).symm calc _ ≤ Real.exp ((7 * B + 6 * Q + Pper + 14) + (3 * B + (B + 1) * Op + 4) + 1) * Real.exp (Pper + B * Op) := mul_le_mul hboth hcover (by positivity) (Real.exp_nonneg _) _ = _ := by rw [← Real.exp_add]; congr 1; ring
theorem allocatedAffineCover_exp_bound {B Op Pper period : ℝ} (gridaxes : ℕ) (hB : 0 ≤ B) (hOp : 0 ≤ Op) (hg : (gridaxes : ℝ) ≤ B) (hperiod : period ≤ Real.exp Pper) : period * (Real.exp Op) ^ gridaxes ≤ Real.exp (Pper + B * Op) := by have hpower : (Real.exp Op) ^ gridaxes ≤ Real.exp (B * Op) := by rw [← Real.exp_nat_mul] exact Real.exp_le_exp.mpr (mul_le_mul hg le_rfl hOp hB) exact (mul_le_mul hperiod hpower (by positivity) (Real.exp_nonneg _)).trans_eq (Real.exp_add _ _).symm
theorem allocatedAffineFactor_nnreal_exp_bound {B Q Op Pper : ℝ} (cutoff coord Qgrid Mp period r radius : ℝ≥0) (axes gridaxes : ℕ) (hB : 0 ≤ B) (hQ : 0 ≤ Q) (hOp : 0 ≤ Op) (hPper : 0 ≤ Pper) (ha : (axes : ℝ) ≤ B) (hg : (gridaxes : ℝ) ≤ B) (hc : (cutoff : ℝ) ≤ Real.exp B) (hcoord : (coord : ℝ) ≤ Real.exp B) (hQgrid : (Qgrid : ℝ) ≤ Real.exp B) (hMp : (Mp : ℝ) ≤ Real.exp Pper) (hper : (period : ℝ) ≤ Real.exp Pper) (hr : 1 ≤ r) (hradius : 1 ≤ radius) : let Llong : ℝ≥0 := (axes * cutoff / (2 * r)) * coord + max ((⟨Real.exp (axes + 6 * Q + 12), Real.exp_nonneg _⟩ + axes * cutoff / (2 * radius)) * coord * Mp) (4 * Mp) let Lprimitive : ℝ≥0 := ⟨Real.exp Op, Real.exp_nonneg _⟩ let Lgrid : ℝ≥0 := max (gridaxes * Lprimitive * Qgrid * coord * Lprimitive ^ gridaxes) (4 * Lprimitive ^ gridaxes) (((Llong + Lgrid) * (period * Lprimitive ^ gridaxes) : ℝ≥0) : ℝ) ≤ Real.exp (10 * B + 6 * Q + 2 * Pper + (2 * B + 1) * Op + 19) := by exact allocatedAffineFactor_exp_bound axes gridaxes hB hQ hOp hPper ha hg cutoff.coe_nonneg coord.coe_nonneg Qgrid.coe_nonneg Mp.coe_nonneg period.coe_nonneg hc hcoord hQgrid hMp hper (show (1 : ℝ) ≤ r from hr) (show (1 : ℝ) ≤ radius from hradius)
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomialopen scoped BigOperators
theorem exists_allocatedAffineModelMass_budget (m dim : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ {D p v F Prho Pk target : ℝ}, 0 ≤ D → 0 ≤ p → 0 ≤ v → 0 ≤ F → 0 ≤ Prho → 0 ≤ Pk → 0 ≤ target → ∀ (outputs axes gridaxes ambient : ℕ), (outputs : ℝ) ≤ D → (axes : ℝ) ≤ D → (gridaxes : ℝ) ≤ D → (ambient : ℝ) ≤ D → (dim : ℝ) ≤ D → (probabilityProfileLipschitz : ℝ) ≤ D → let Eg := outputs * Prho + (target + F) + 1 let Op := allocatedSlicedGridResourceLog m dim D p v Eg let Plong := ((m : ℝ) + 2) * dim + m + 4 + Prho + axes * max Op 0 + (target + F) + 2 let Q := idealSiteLogBudget outputs dim Plong 2 * (2 : ℝ) ^ dim + F + (2 : ℝ) ^ dim * (ambient * ((m + 1 : ℕ) * Pk)) + ((2 : ℝ) ^ dim * axes * (4 * Q + 8) + Q) + gridaxes * Op ≤ (D + p + v + F + Prho + Pk + target + A) ^ A := by obtain ⟨b, hb, hgrid⟩ := exists_allocatedSlicedGridResource_budget m dim let X : Polynomial ℕ := Polynomial.X let O : Polynomial ℕ := (3 * X + (X ^ 2 + 2 * X + 1) + Polynomial.C b) ^ b let Pbox : Polynomial ℕ := Polynomial.C ((m + 2) * dim + m + 4) let Pl : Polynomial ℕ := Pbox + X + X * O + 2 * X + 2 let Qp := allocatedFiniteIdealProfileLog X Pl let poly : Polynomial ℕ := 2 * (2 : Polynomial ℕ) ^ dim + X + (2 : Polynomial ℕ) ^ dim * (X * ((m + 1 : ℕ) * X)) + ((2 : Polynomial ℕ) ^ dim * X * (4 * Qp + 8) + Qp) + X * O obtain ⟨A, hA, hbound⟩ := exists_natPolynomial_eval_budget poly refine ⟨A, hA, ?_⟩ intro D p v F Prho Pk target hD hp hv hF hPrho hPk htarget outputs axes gridaxes ambient hout haxes hgridaxes hamb hdim hprofile Eg Op Plong Q let R := D + p + v + F + Prho + Pk + target have hR : 0 ≤ R := by dsimp [R]; positivity have hDR : D ≤ R := by dsimp [R]; linarith have hpR : p ≤ R := by dsimp [R]; linarith have hvR : v ≤ R := by dsimp [R]; linarith have hFR : F ≤ R := by dsimp [R]; linarith have hPrhoR : Prho ≤ R := by dsimp [R]; linarith have hPkR : Pk ≤ R := by dsimp [R]; linarith have htR : target ≤ R := by dsimp [R]; linarith have hEg : 0 ≤ Eg := by dsimp [Eg]; positivity have hEgR : Eg ≤ R ^ 2 + 2 * R + 1 := by have hprod := mul_le_mul (hout.trans hDR) hPrhoR hPrho hR dsimp only [Eg] nlinarith only [hprod, htR, hFR] let Ob := (3 * R + (R ^ 2 + 2 * R + 1) + b) ^ b have hOb : 0 ≤ Ob := by dsimp [Ob]; positivity have hOp : 0 ≤ Op := allocatedSlicedGridResourceLog_nonneg m dim hD hp hv hEg have hOpR : Op ≤ Ob := (hgrid hD hp hv hEg).trans (pow_le_pow_left₀ (by positivity) (by linarith only [hDR, hpR, hvR, hEgR]) b) let Plb := (((m + 2) * dim + m + 4 : ℕ) : ℝ) + R + R * Ob + 2 * R + 2 have hPlb : 0 ≤ Plb := by dsimp [Plb]; positivity have hPl : 0 ≤ Plong := by dsimp [Plong]; positivity have hPlR : Plong ≤ Plb := by have hm : (axes : ℝ) * max Op 0 ≤ R * Ob := by rw [max_eq_left hOp] exact mul_le_mul (haxes.trans hDR) hOpR hOp hR dsimp only [Plong, Plb] push_cast linarith only [hPrhoR, htR, hFR, hm] let Qb := allocatedFiniteIdealProfileLog R Plb have hQb : 0 ≤ Qb := (allocatedFiniteIdeal_budget_nonneg m hR hPlb (le_refl (0 : ℝ))).1 have hQ : 0 ≤ Q := (idealSiteLogBudget_bounds outputs dim hPl).1 have hQR : Q ≤ Qb := by apply (idealSiteLogBudget_le_finite_profile hPl hout hdim hprofile).trans change allocatedFiniteIdealProfileLog D Plong ≤ allocatedFiniteIdealProfileLog R Plb unfold allocatedFiniteIdealProfileLog gcongr have hmass : 2 * (2 : ℝ) ^ dim + F + (2 : ℝ) ^ dim * (ambient * ((m + 1 : ℕ) * Pk)) + ((2 : ℝ) ^ dim * axes * (4 * Q + 8) + Q) + gridaxes * Op ≤ 2 * (2 : ℝ) ^ dim + R + (2 : ℝ) ^ dim * (R * ((m + 1 : ℕ) * R)) + ((2 : ℝ) ^ dim * R * (4 * Qb + 8) + Qb) + R * Ob := by gcongr · exact hamb.trans hDR · exact haxes.trans hDR · exact hgridaxes.trans hDR apply hmass.trans simpa [poly, X, O, Pbox, Pl, Qp, Ob, Plb, Qb, allocatedFiniteIdealProfileLog, Polynomial.eval₂_pow] using hbound R hR
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomialopen scoped BigOperators NNReal
theorem exists_allocatedAffineAnalytic_budget (m dim : ℕ) : ∃ A : ℕ, 2 ≤ A ∧ ∀ {D p v F Prho Pk target B : ℝ}, 0 ≤ D → 0 ≤ p → 0 ≤ v → 0 ≤ F → 0 ≤ Prho → 0 ≤ Pk → 0 ≤ target → 0 ≤ B → ∀ (outputs axes : ℕ), (outputs : ℝ) ≤ D → (axes : ℝ) ≤ D → (dim : ℝ) ≤ D → (probabilityProfileLipschitz : ℝ) ≤ D → let Eg := outputs * Prho + (target + F) + 1 let Op := allocatedSlicedGridResourceLog m dim D p v Eg let Plong := ((m : ℝ) + 2) * dim + m + 4 + Prho + axes * max Op 0 + (target + F) + 2 let Q := idealSiteLogBudget outputs dim Plong 10 * B + 6 * Q + 2 * ((m + 1 : ℕ) * Pk) + (2 * B + 1) * Op + 19 ≤ (D + p + v + F + Prho + Pk + target + B + A) ^ A := by obtain ⟨b, hb, hgrid⟩ := exists_allocatedSlicedGridResource_budget m dim let X : Polynomial ℕ := Polynomial.X let O : Polynomial ℕ := (3 * X + (X ^ 2 + 2 * X + 1) + Polynomial.C b) ^ b let Pbox : Polynomial ℕ := Polynomial.C ((m + 2) * dim + m + 4) let Pl : Polynomial ℕ := Pbox + X + X * O + 2 * X + 2 let Qp := allocatedFiniteIdealProfileLog X Pl let poly : Polynomial ℕ := 10 * X + 6 * Qp + 2 * ((m + 1 : ℕ) * X) + (2 * X + 1) * O + 19 obtain ⟨A, hA, hbound⟩ := exists_natPolynomial_eval_budget poly refine ⟨A, hA, ?_⟩ intro D p v F Prho Pk target B hD hp hv hF hPrho hPk htarget hB outputs axes hout haxes hdim hprofile Eg Op Plong Q let R := D + p + v + F + Prho + Pk + target + B have hR : 0 ≤ R := by dsimp [R]; positivity have hBR : B ≤ R := by dsimp [R]; linarith have hDR : D ≤ R := by dsimp [R]; linarith have hpR : p ≤ R := by dsimp [R]; linarith have hvR : v ≤ R := by dsimp [R]; linarith have hFR : F ≤ R := by dsimp [R]; linarith have hPrhoR : Prho ≤ R := by dsimp [R]; linarith have hPkR : Pk ≤ R := by dsimp [R]; linarith have htR : target ≤ R := by dsimp [R]; linarith have hEg : 0 ≤ Eg := by dsimp [Eg]; positivity have hEgR : Eg ≤ R ^ 2 + 2 * R + 1 := by have hprod := mul_le_mul (hout.trans hDR) hPrhoR hPrho hR dsimp only [Eg] nlinarith only [hprod, htR, hFR] let Ob := (3 * R + (R ^ 2 + 2 * R + 1) + b) ^ b have hOb : 0 ≤ Ob := by dsimp [Ob]; positivity have hOp : 0 ≤ Op := allocatedSlicedGridResourceLog_nonneg m dim hD hp hv hEg have hOpR : Op ≤ Ob := (hgrid hD hp hv hEg).trans (pow_le_pow_left₀ (by positivity) (by linarith only [hDR, hpR, hvR, hEgR]) b) let Plb := (((m + 2) * dim + m + 4 : ℕ) : ℝ) + R + R * Ob + 2 * R + 2 have hPlb : 0 ≤ Plb := by dsimp [Plb]; positivity have hPl : 0 ≤ Plong := by dsimp [Plong]; positivity have hPlR : Plong ≤ Plb := by have hm : (axes : ℝ) * max Op 0 ≤ R * Ob := by rw [max_eq_left hOp] exact mul_le_mul (haxes.trans hDR) hOpR hOp hR dsimp only [Plong, Plb] push_cast linarith only [hPrhoR, htR, hFR, hm] let Qb := allocatedFiniteIdealProfileLog R Plb have hQb : 0 ≤ Qb := (allocatedFiniteIdeal_budget_nonneg m hR hPlb (le_refl (0 : ℝ))).1 have hQ : 0 ≤ Q := (idealSiteLogBudget_bounds outputs dim hPl).1 have hQR : Q ≤ Qb := by apply (idealSiteLogBudget_le_finite_profile hPl hout hdim hprofile).trans change allocatedFiniteIdealProfileLog D Plong ≤ allocatedFiniteIdealProfileLog R Plb unfold allocatedFiniteIdealProfileLog gcongr have hcost : 10 * B + 6 * Q + 2 * ((m + 1 : ℕ) * Pk) + (2 * B + 1) * Op + 19 ≤ 10 * R + 6 * Qb + 2 * ((m + 1 : ℕ) * R) + (2 * R + 1) * Ob + 19 := by gcongr apply hcost.trans simpa [poly, X, O, Pbox, Pl, Qp, Ob, Plb, Qb, allocatedFiniteIdealProfileLog, Polynomial.eval₂_pow] using hbound R hR
theorem allocatedAffineAnalytic_bounds (m dim outputs axes gridaxes : ℕ) {D p v F Prho Pk target B : ℝ} (hD : 0 ≤ D) (hp : 0 ≤ p) (hv : 0 ≤ v) (hF : 0 ≤ F) (hPrho : 0 ≤ Prho) (hPk : 0 ≤ Pk) (htarget : 0 ≤ target) (hB : 0 ≤ B) (hout : (outputs : ℝ) ≤ D) (haxes : (axes : ℝ) ≤ D) (hdim : (dim : ℝ) ≤ D) (hprofile : (probabilityProfileLipschitz : ℝ) ≤ D) (hDB : D ≤ B) (hgrid : (gridaxes : ℝ) ≤ B) (cutoff coord Qgrid r radius : ℝ≥0) (hr : 1 ≤ r) (hradius : 1 ≤ radius) (hc : (cutoff : ℝ) ≤ Real.exp B) (hcoord : (coord : ℝ) ≤ Real.exp B) (hQgrid : (Qgrid : ℝ) ≤ Real.exp B) (M period : ℕ) (hM : (M : ℝ) ≤ Real.exp Pk) (hperiod : period ≤ M ^ (m + 1)) : let A := Classical.choose (exists_allocatedAffineAnalytic_budget m dim) let Eg := outputs * Prho + (target + F) + 1 let Op := allocatedSlicedGridResourceLog m dim D p v Eg let Plong := ((m : ℝ) + 2) * Fintype.card (Fin dim) + m + 4 + Prho + axes * max Op 0 + (target + F) + 2 let Q := idealSiteLogBudget outputs (Fintype.card (Fin dim)) Plong let Llong : ℝ≥0 := (axes * cutoff / (2 * r)) * coord + max ((⟨Real.exp (axes + 6 * Q + 12), Real.exp_nonneg _⟩ + axes * cutoff / (2 * radius)) * coord * (M ^ (m + 1))) (4 * (M ^ (m + 1))) let Lprimitive : ℝ≥0 := ⟨Real.exp Op, Real.exp_nonneg _⟩ let Lgrid : ℝ≥0 := max (gridaxes * Lprimitive * Qgrid * coord * Lprimitive ^ gridaxes) (4 * Lprimitive ^ gridaxes) (((Llong + Lgrid) * (period * Lprimitive ^ gridaxes) : ℝ≥0) : ℝ) ≤ Real.exp ((D + p + v + F + Prho + Pk + target + B + A) ^ A) ∧ (period : ℝ) * (Real.exp Op) ^ gridaxes ≤ Real.exp ((D + p + v + F + Prho + Pk + target + B + A) ^ A) := by intro A Eg Op Plong Q Llong Lprimitive Lgrid have hEg : 0 ≤ Eg := by dsimp only [Eg]; positivity have hOp := allocatedSlicedGridResourceLog_nonneg m dim hD hp hv hEg have hPlong : 0 ≤ Plong := by dsimp only [Plong]; positivity have hQ := (idealSiteLogBudget_bounds outputs (Fintype.card (Fin dim)) hPlong).1 have hMp : ((M ^ (m + 1) : ℝ≥0) : ℝ) ≤ Real.exp (((m + 1 : ℕ) : ℝ) * Pk) := by change (M : ℝ) ^ (m + 1) ≤ _ calc _ ≤ (Real.exp Pk) ^ (m + 1) := pow_le_pow_left₀ (Nat.cast_nonneg _) hM _ _ = _ := (Real.exp_nat_mul _ _).symm have hper : (period : ℝ) ≤ Real.exp (((m + 1 : ℕ) : ℝ) * Pk) := (by exact_mod_cast hperiod : (period : ℝ) ≤ (M : ℝ) ^ (m + 1)).trans hMp have hlog : 10 * B + 6 * Q + 2 * (((m + 1 : ℕ) : ℝ) * Pk) + (2 * B + 1) * Op + 19 ≤ (D + p + v + F + Prho + Pk + target + B + A) ^ A := by simpa only [Q, Plong, Fintype.card_fin] using (Classical.choose_spec (exists_allocatedAffineAnalytic_budget m dim)).2 hD hp hv hF hPrho hPk htarget hB outputs axes hout haxes hdim hprofile exact ⟨(allocatedAffineFactor_nnreal_exp_bound cutoff coord Qgrid (M ^ (m + 1)) period r radius axes gridaxes hB hQ hOp (by positivity) (haxes.trans hDB) hgrid hc hcoord hQgrid hMp hper hr hradius).trans (Real.exp_le_exp.mpr hlog), (allocatedAffineCover_exp_bound gridaxes hB hOp hgrid hper).trans (Real.exp_le_exp.mpr (le_trans (by have hper0 : 0 ≤ (((m + 1 : ℕ) : ℝ) * Pk) := mul_nonneg (Nat.cast_nonneg _) hPk nlinarith only [hB, hQ, hOp, hper0, mul_nonneg hB hOp]) hlog))⟩
end Erdos3.VectorPolynomial
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409import OAI.Combinatorics.Progressions.Estimates.AllocatedExternalCandidateThresholdSuccessorimport OAI.Combinatorics.Progressions.Lattices.AllocatedAffinePhysicalTerminalReset
namespace OAI
section
namespace Erdos3.VectorPolynomial
def allocatedAffineResetHeightLog (p : ℝ) : ℝ := (p + 4) ^ 12
theorem allocatedAffineResetHeightLog_bounds {p : ℝ} (hp : 0 ≤ p) : 0 ≤ allocatedAffineResetHeightLog p ∧ p ≤ allocatedAffineResetHeightLog p ∧ (p + 4) ^ 11 ≤ allocatedAffineResetHeightLog p ∧ (p + 3) ^ 7 ≤ allocatedAffineResetHeightLog p ∧ (p + 2) ^ 4 ≤ allocatedAffineResetHeightLog p := by have hbase : 1 ≤ p + 4 := by linarith have hlinear : p + 4 ≤ (p + 4) ^ 12 := by simpa only [pow_one] using pow_le_pow_right₀ hbase (by norm_num : 1 ≤ 12) have h11 : (p + 4) ^ 11 ≤ (p + 4) ^ 12 := pow_le_pow_right₀ hbase (by norm_num) have h7 : (p + 3) ^ 7 ≤ (p + 4) ^ 12 := (pow_le_pow_left₀ (by linarith : 0 ≤ p + 3) (by linarith : p + 3 ≤ p + 4) 7).trans (pow_le_pow_right₀ hbase (by norm_num)) have h4 : (p + 2) ^ 4 ≤ (p + 4) ^ 12 := (pow_le_pow_left₀ (by linarith : 0 ≤ p + 2) (by linarith : p + 2 ≤ p + 4) 4).trans (pow_le_pow_right₀ hbase (by norm_num)) dsimp only [allocatedAffineResetHeightLog] exact ⟨pow_nonneg (by linarith) _, (by linarith), h11, h7, h4⟩
theorem allocatedAffineResetHeightLog_exp_bounds {p : ℝ} (hp : 0 ≤ p) : 1 ≤ Real.exp (allocatedAffineResetHeightLog p) ∧ Real.exp p ≤ Real.exp (allocatedAffineResetHeightLog p) ∧ Real.exp ((p + 4) ^ 11) ≤ Real.exp (allocatedAffineResetHeightLog p) ∧ Real.exp ((p + 3) ^ 7) ≤ Real.exp (allocatedAffineResetHeightLog p) ∧ Real.exp ((p + 2) ^ 4) ≤ Real.exp (allocatedAffineResetHeightLog p) := by obtain ⟨h0, hp', h11, h7, h4⟩ := allocatedAffineResetHeightLog_bounds hp exact ⟨Real.one_le_exp_iff.mpr h0, Real.exp_le_exp.mpr hp', Real.exp_le_exp.mpr h11, Real.exp_le_exp.mpr h7, Real.exp_le_exp.mpr h4⟩
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomialopen NilpotentLieFiltration
noncomputable def allocatedAffineResetRightLog (s : ℕ) (pFull : ℝ) : ℝ := (pFull + allocatedEarlyAffineRightExponent (s + 1) 4) ^ allocatedEarlyAffineRightExponent (s + 1) 4
noncomputable def allocatedAffineResetLeftLog (s : ℕ) (pFull : ℝ) : ℝ := (pFull + allocatedEarlyAffineLeftExponent (s + 1) 4) ^ allocatedEarlyAffineLeftExponent (s + 1) 4
noncomputable def allocatedAffineResetCompareLog (s : ℕ) (pNative : ℝ) : ℝ := (pNative + allocatedAffineResetCompareExponent s) ^ allocatedAffineResetCompareExponent s
noncomputable def allocatedAffineResetMapBudget (s : ℕ) (p0 pFull : ℝ) : ℝ := ordinaryImagePointwiseBudget (s + 1) (s + 1) p0 + allocatedAffineResetHeightLog p0 + 1 + p0 + allocatedAffineResetRightLog s pFull
noncomputable def allocatedAffineCanonicalNativeBudget (s : ℕ) (p0 pFull : ℝ) : ℝ := allocatedAffineResetNativeBudget s pFull (allocatedAffineResetMapBudget s p0 pFull) p0
noncomputable def allocatedAffineCanonicalBudget (s : ℕ) (p0 pFull : ℝ) : ℝ := p0 + pFull + allocatedAffineResetMapBudget s p0 pFull + allocatedAffineCanonicalNativeBudget s p0 pFull + allocatedAffineResetLogBudget s (allocatedAffineCanonicalNativeBudget s p0 pFull) + allocatedAffineResetCompareLog s (allocatedAffineCanonicalNativeBudget s p0 pFull) + allocatedAffineResetLeftLog s pFull + (s + 2 : ℕ)
structure AllocatedAffineResetMapBudgetBounds (s : ℕ) (p0 pFull : ℝ) : Prop where nonnegative : 0 ≤ allocatedAffineResetMapBudget s p0 pFull input : p0 ≤ allocatedAffineResetMapBudget s p0 pFull pointwise : ordinaryImagePointwiseBudget (s + 1) (s + 1) p0 ≤ allocatedAffineResetMapBudget s p0 pFull height : allocatedAffineResetHeightLog p0 + 1 ≤ allocatedAffineResetMapBudget s p0 pFull denominatorLog : p0 + allocatedAffineResetRightLog s pFull ≤ allocatedAffineResetMapBudget s p0 pFull
theorem allocatedAffineResetMapBudget_bounds (s : ℕ) {p0 pFull : ℝ} (hp0 : 0 ≤ p0) (hFull : 0 ≤ pFull) : AllocatedAffineResetMapBudgetBounds s p0 pFull := by have hsection : 0 ≤ ordinaryImagePointwiseBudget (s + 1) (s + 1) p0 := hp0.trans (ordinaryImagePointwiseBudget_ge (s + 1) (s + 1) hp0) have hheight : 0 ≤ allocatedAffineResetHeightLog p0 := by unfold allocatedAffineResetHeightLog positivity have hright : 0 ≤ allocatedAffineResetRightLog s pFull := by unfold allocatedAffineResetRightLog positivity constructor <;> dsimp only [allocatedAffineResetMapBudget] <;> linarith
theorem allocatedAffineResetMapBudget_denominator (s : ℕ) {p0 pFull : ℝ} (hp0 : 0 ≤ p0) (hFull : 0 ≤ pFull) {l n : ℕ} (hl : (l : ℝ) ≤ Real.exp p0) (hn : (n : ℝ) ≤ Real.exp (allocatedAffineResetRightLog s pFull)) : ((l * n : ℕ) : ℝ) ≤ Real.exp (allocatedAffineResetMapBudget s p0 pFull) := by rw [Nat.cast_mul] calc (l : ℝ) * n ≤ Real.exp p0 * Real.exp (allocatedAffineResetRightLog s pFull) := mul_le_mul hl hn (Nat.cast_nonneg _) (Real.exp_pos _).le _ = Real.exp (p0 + allocatedAffineResetRightLog s pFull) := (Real.exp_add _ _).symm _ ≤ _ := Real.exp_le_exp.mpr (allocatedAffineResetMapBudget_bounds s hp0 hFull).denominatorLog
theorem allocatedAffineResetLogBudget_nonnegative (s : ℕ) {p : ℝ} (hp : 0 ≤ p) : 0 ≤ allocatedAffineResetLogBudget s p := by unfold allocatedAffineResetLogBudget markedNativeLiftInput fullMarkedNativeInput pointwiseFastSectionInput positivity
structure AllocatedAffineCanonicalBudgetBounds (s : ℕ) (p0 pFull : ℝ) : Prop where nonnegative : 0 ≤ allocatedAffineCanonicalBudget s p0 pFull map_nonnegative : 0 ≤ allocatedAffineResetMapBudget s p0 pFull native_nonnegative : 0 ≤ allocatedAffineCanonicalNativeBudget s p0 pFull input : p0 ≤ allocatedAffineCanonicalBudget s p0 pFull full : pFull ≤ allocatedAffineCanonicalBudget s p0 pFull map : allocatedAffineResetMapBudget s p0 pFull ≤ allocatedAffineCanonicalBudget s p0 pFull native : allocatedAffineCanonicalNativeBudget s p0 pFull ≤ allocatedAffineCanonicalBudget s p0 pFull native_input : p0 ≤ allocatedAffineCanonicalNativeBudget s p0 pFull native_full : pFull ≤ allocatedAffineCanonicalNativeBudget s p0 pFull native_map : allocatedAffineResetMapBudget s p0 pFull ≤ allocatedAffineCanonicalNativeBudget s p0 pFull reset : allocatedAffineResetLogBudget s (allocatedAffineCanonicalNativeBudget s p0 pFull) ≤ allocatedAffineCanonicalBudget s p0 pFull compare : allocatedAffineResetCompareLog s (allocatedAffineCanonicalNativeBudget s p0 pFull) ≤ allocatedAffineCanonicalBudget s p0 pFull physical : allocatedAffineResetLeftLog s pFull ≤ allocatedAffineCanonicalBudget s p0 pFull interpolation_log : p0 + (s + 2 : ℕ) ≤ allocatedAffineCanonicalBudget s p0 pFull
theorem allocatedAffineCanonicalBudget_bounds (s : ℕ) {p0 pFull : ℝ} (hp0 : 0 ≤ p0) (hFull : 0 ≤ pFull) : AllocatedAffineCanonicalBudgetBounds s p0 pFull := by have hm := allocatedAffineResetMapBudget_bounds s hp0 hFull obtain ⟨hn, hnf, hnm, hnq, hnl, hn4, hn3⟩ := affineResetNativeBudget_bounds (allocatedEarlyAffineLeftExponent (s + 1) 4) hFull hm.nonnegative (q := p0) change 0 ≤ allocatedAffineCanonicalNativeBudget s p0 pFull at hn change pFull ≤ allocatedAffineCanonicalNativeBudget s p0 pFull at hnf change allocatedAffineResetMapBudget s p0 pFull ≤ allocatedAffineCanonicalNativeBudget s p0 pFull at hnm change p0 ≤ allocatedAffineCanonicalNativeBudget s p0 pFull at hnq have hreset := allocatedAffineResetLogBudget_nonnegative s hn have hcompare : 0 ≤ allocatedAffineResetCompareLog s (allocatedAffineCanonicalNativeBudget s p0 pFull) := by unfold allocatedAffineResetCompareLog positivity have hleft : 0 ≤ allocatedAffineResetLeftLog s pFull := by unfold allocatedAffineResetLeftLog positivity have hs : (0 : ℝ) ≤ (s + 2 : ℕ) := Nat.cast_nonneg _ constructor · dsimp only [allocatedAffineCanonicalBudget]; linarith [hm.nonnegative] · exact hm.nonnegative · exact hn · dsimp only [allocatedAffineCanonicalBudget]; linarith [hm.nonnegative] · dsimp only [allocatedAffineCanonicalBudget]; linarith [hm.nonnegative] · dsimp only [allocatedAffineCanonicalBudget]; linarith · dsimp only [allocatedAffineCanonicalBudget]; linarith [hm.nonnegative] · exact hnq · exact hnf · exact hnm · dsimp only [allocatedAffineCanonicalBudget]; linarith [hm.nonnegative] · dsimp only [allocatedAffineCanonicalBudget]; linarith [hm.nonnegative] · dsimp only [allocatedAffineCanonicalBudget]; linarith [hm.nonnegative] · dsimp only [allocatedAffineCanonicalBudget]; linarith [hm.nonnegative]
structure AllocatedAffineCanonicalExpBounds (s : ℕ) (p0 pFull : ℝ) : Prop where map_absorption : Real.exp ((allocatedAffineResetMapBudget s p0 pFull + 2) ^ 4) ≤ Real.exp (allocatedAffineCanonicalNativeBudget s p0 pFull) physical_absorption : Real.exp (allocatedAffineResetLeftLog s pFull) ≤ Real.exp ((allocatedAffineCanonicalNativeBudget s p0 pFull + 2) ^ (1 : ℕ)) original_absorption : Real.exp p0 ≤ Real.exp ((allocatedAffineCanonicalNativeBudget s p0 pFull + 2) ^ (1 : ℕ)) mapped_absorption : Real.exp ((allocatedAffineResetMapBudget s p0 pFull + 2) ^ 3 + p0) ≤ Real.exp ((allocatedAffineCanonicalNativeBudget s p0 pFull + 2) ^ (1 : ℕ)) compare_cutoff : Real.exp (allocatedAffineResetCompareLog s (allocatedAffineCanonicalNativeBudget s p0 pFull)) ≤ Real.exp (candidatePrimitiveFreezingCutoff s 1 (allocatedAffineCanonicalBudget s p0 pFull)) cost_cutoff : ∀ cost : ℝ, cost ≤ p0 → Real.exp cost ≤ Real.exp (candidatePrimitiveFreezingCutoff s 1 (allocatedAffineCanonicalBudget s p0 pFull)) interpolation : ∀ cost : ℝ, cost ��� p0 → Real.exp cost * (s + 2 : ℕ) ≤ Real.exp (candidatePrimitiveFreezingCutoff s 1 (allocatedAffineCanonicalBudget s p0 pFull))
theorem allocatedAffineCanonicalBudget_exp_bounds (s : ℕ) {p0 pFull : ℝ} (hp0 : 0 ≤ p0) (hFull : 0 ≤ pFull) : AllocatedAffineCanonicalExpBounds s p0 pFull := by have hb := allocatedAffineCanonicalBudget_bounds s hp0 hFull obtain ⟨_, _, _, hm, hf, hq, hmq⟩ := allocatedAffineResetNativeBudget_exp_bounds s hFull hb.map_nonnegative (q := p0) have hcut := candidatePrimitiveFreezingCutoff_ge_input s 1 hb.nonnegative refine ⟨hm, hf, hq, hmq, Real.exp_le_exp.mpr (hb.compare.trans hcut), ?_, ?_⟩ · intro cost hcost exact Real.exp_le_exp.mpr ((hcost.trans hb.input).trans hcut) · intro cost hcost have hs : ((s + 2 : ℕ) : ℝ) ≤ Real.exp (s + 2 : ℕ) := by linarith [Real.add_one_le_exp ((s + 2 : ℕ) : ℝ)] calc Real.exp cost * (s + 2 : ℕ) ≤ Real.exp cost * Real.exp (s + 2 : ℕ) := mul_le_mul_of_nonneg_left hs (Real.exp_pos _).le _ = Real.exp (cost + (s + 2 : ℕ)) := (Real.exp_add _ _).symm _ ≤ _ := Real.exp_le_exp.mpr ((add_le_add hcost le_rfl).trans (hb.interpolation_log.trans hcut))
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomial
open NilpotentLieFiltration
theorem allocatedAffineCanonicalBudget_le_diagonal (s : ℕ) {p0 pFull B : ℝ} (hp0 : 0 ≤ p0) (hFull : 0 ≤ pFull) (hp0B : p0 ≤ B) (hFullB : pFull ≤ B) : allocatedAffineCanonicalBudget s p0 pFull ≤ allocatedAffineCanonicalBudget s B B := by have hB : 0 ≤ B := hp0.trans hp0B have hmap0 := (allocatedAffineResetMapBudget_bounds s hp0 hFull).nonnegative have hnative0 := (allocatedAffineCanonicalBudget_bounds s hp0 hFull).native_nonnegative have hpoint : ordinaryImagePointwiseBudget (s + 1) (s + 1) p0 ≤ ordinaryImagePointwiseBudget (s + 1) (s + 1) B := by unfold ordinaryImagePointwiseBudget pointwiseFastSectionInput gcongr have hmap : allocatedAffineResetMapBudget s p0 pFull ≤ allocatedAffineResetMapBudget s B B := by unfold allocatedAffineResetMapBudget allocatedAffineResetHeightLog allocatedAffineResetRightLog gcongr have hnative : allocatedAffineCanonicalNativeBudget s p0 pFull ≤ allocatedAffineCanonicalNativeBudget s B B := by unfold allocatedAffineCanonicalNativeBudget allocatedAffineResetNativeBudget affineResetNativeBudget gcongr have hreset : allocatedAffineResetLogBudget s (allocatedAffineCanonicalNativeBudget s p0 pFull) ≤ allocatedAffineResetLogBudget s (allocatedAffineCanonicalNativeBudget s B B) := by unfold allocatedAffineResetLogBudget markedNativeLiftInput fullMarkedNativeInput pointwiseFastSectionInput gcongr have hcompare : allocatedAffineResetCompareLog s (allocatedAffineCanonicalNativeBudget s p0 pFull) ≤ allocatedAffineResetCompareLog s (allocatedAffineCanonicalNativeBudget s B B) := by unfold allocatedAffineResetCompareLog gcongr have hleft : allocatedAffineResetLeftLog s pFull ≤ allocatedAffineResetLeftLog s B := by unfold allocatedAffineResetLeftLog gcongr unfold allocatedAffineCanonicalBudget linarith
end Erdos3.VectorPolynomial
end
section
namespace Erdos3.VectorPolynomialopen NilpotentLieFiltration
private noncomputable def canonicalSectionPolynomial (s : ℕ) (P : Polynomial ℕ) : Polynomial ℕ := 2 * (P + Polynomial.C (s + 3)) ^ (s + 3) + ((P + Polynomial.C (s + 3)) ^ (s + 3)) ^ 2 + P
noncomputable def allocatedAffineCanonicalBudgetPolynomial (s : ℕ) : Polynomial ℕ := let X := Polynomial.X let sectionPoly := canonicalSectionPolynomial (s + 1) X let right := (X + Polynomial.C (allocatedEarlyAffineRightExponent (s + 1) 4)) ^ allocatedEarlyAffineRightExponent (s + 1) 4 let left := (X + Polynomial.C (allocatedEarlyAffineLeftExponent (s + 1) 4)) ^ allocatedEarlyAffineLeftExponent (s + 1) 4 let map := sectionPoly + sectionPoly + (X + 2) ^ 5 + (X + 4) ^ 12 + 1 + X + right let native := X + map + X + left + (map + 2) ^ 4 let nativeSection := canonicalSectionPolynomial (s + 1) native let full := (nativeSection + Polynomial.C (allocatedAffineResetFactorExponent s)) ^ allocatedAffineResetFactorExponent s + (native + 2) ^ 1 + nativeSection let reset := ((full + 2) ^ 11 + full + Polynomial.C (allocatedAffineResetLiftExponent s)) ^ allocatedAffineResetLiftExponent s X + X + map + native + reset + (native + Polynomial.C (allocatedAffineResetCompareExponent s)) ^ allocatedAffineResetCompareExponent s + left + Polynomial.C (s + 2)
theorem allocatedAffineCanonicalBudgetPolynomial_eval (s : ℕ) {B : ℝ} (hB : 0 ≤ B) : (allocatedAffineCanonicalBudgetPolynomial s).eval₂ (Nat.castRingHom ℝ) B = allocatedAffineCanonicalBudget s B B := by simp only [allocatedAffineCanonicalBudgetPolynomial, canonicalSectionPolynomial, allocatedAffineCanonicalBudget, allocatedAffineResetMapBudget, allocatedAffineCanonicalNativeBudget, allocatedAffineResetNativeBudget, affineResetNativeBudget, allocatedAffineResetRightLog, allocatedAffineResetLeftLog, allocatedAffineResetCompareLog, allocatedAffineResetLogBudget, ordinaryImagePointwiseBudget, allocatedAffineResetHeightLog, markedNativeLiftInput, fullMarkedNativeInput, pointwiseFastSectionInput, max_eq_left hB, Polynomial.eval₂_add, Polynomial.eval₂_mul, Polynomial.eval₂_pow, Polynomial.eval₂_X, Polynomial.eval₂_C, Polynomial.eval₂_ofNat, Polynomial.eval₂_one, Nat.coe_castRingHom, Nat.cast_add, Nat.cast_one, Nat.cast_ofNat]
noncomputable def allocatedAffineCanonicalBackendPolynomial (s : ℕ) : Polynomial ℕ := let P := allocatedAffineCanonicalBudgetPolynomial s P + 12 * (P + Polynomial.C (candidatePrimitivePhysicalBudgetExponent s 1)) ^ candidatePrimitivePhysicalBudgetExponent s 1 + 32
theorem allocatedAffineCanonicalBackendPolynomial_eval (s : ℕ) {B : ℝ} (hB : 0 ≤ B) : (allocatedAffineCanonicalBackendPolynomial s).eval₂ (Nat.castRingHom ℝ) B = allocatedAffineCanonicalBudget s B B + finiteFreezingRecursiveParameter (candidatePrimitivePhysicalBudgetExponent s 1) (allocatedAffineCanonicalBudget s B B) := by simp only [allocatedAffineCanonicalBackendPolynomial, Polynomial.eval₂_add, Polynomial.eval₂_mul, Polynomial.eval₂_pow, Polynomial.eval₂_C, Polynomial.eval₂_ofNat, Nat.coe_castRingHom, allocatedAffineCanonicalBudgetPolynomial_eval s hB, finiteFreezingRecursiveParameter] ring
private theorem power_le_recursiveParameter (C : ℕ) {p : ℝ} (hp : 0 ≤ p) : (p + C) ^ C ≤ finiteFreezingRecursiveParameter C p := by have hpow : 0 ≤ (p + C) ^ C := pow_nonneg (by positivity) _ unfold finiteFreezingRecursiveParameter linarith only [hpow]
theorem allocatedAffineCanonical_cutoffCost_le_recursive (s : ℕ) {p0 pFull : ℝ} (hp0 : 0 ≤ p0) (hFull : 0 ≤ pFull) : candidateSideCutoffCost (Real.exp (candidatePrimitiveFreezingCutoff s 1 (allocatedAffineCanonicalBudget s p0 pFull))) ≤ finiteFreezingRecursiveParameter (candidatePrimitivePhysicalBudgetExponent s 1) (allocatedAffineCanonicalBudget s p0 pFull) := by have hp := (allocatedAffineCanonicalBudget_bounds s hp0 hFull).nonnegative exact ((candidatePrimitiveFreezingCutoff_integer_cost s 1 hp).trans (candidatePrimitiveFreezingCutoff_add_two_le_budget s 1 hp)).trans (power_le_recursiveParameter _ hp)
structure AllocatedAffineCanonicalBackendBounds (s : ℕ) (p0 pFull upper : ℝ) : Prop where canonical : allocatedAffineCanonicalBudget s p0 pFull ≤ upper recursive : finiteFreezingRecursiveParameter (candidatePrimitivePhysicalBudgetExponent s 1) (allocatedAffineCanonicalBudget s p0 pFull) ≤ upper cutoff : candidatePrimitiveFreezingCutoff s 1 (allocatedAffineCanonicalBudget s p0 pFull) ≤ upper cutoff_cost : candidateSideCutoffCost (Real.exp (candidatePrimitiveFreezingCutoff s 1 (allocatedAffineCanonicalBudget s p0 pFull))) ≤ upper
theorem allocatedAffineCanonicalBackendPolynomial_bounds (s : ℕ) {p0 pFull B : ℝ} (hp0 : 0 ≤ p0) (hFull : 0 ≤ pFull) (hp0B : p0 ≤ B) (hFullB : pFull ≤ B) : AllocatedAffineCanonicalBackendBounds s p0 pFull ((allocatedAffineCanonicalBackendPolynomial s).eval₂ (Nat.castRingHom ℝ) B) := by have hB := hp0.trans hp0B have hp := (allocatedAffineCanonicalBudget_bounds s hp0 hFull).nonnegative have hd := (allocatedAffineCanonicalBudget_bounds s hB hB).nonnegative have hdiag := allocatedAffineCanonicalBudget_le_diagonal s hp0 hFull hp0B hFullB have hrec : finiteFreezingRecursiveParameter (candidatePrimitivePhysicalBudgetExponent s 1) (allocatedAffineCanonicalBudget s p0 pFull) ≤ finiteFreezingRecursiveParameter (candidatePrimitivePhysicalBudgetExponent s 1) (allocatedAffineCanonicalBudget s B B) := by unfold finiteFreezingRecursiveParameter gcongr have hrec0 : 0 ≤ finiteFreezingRecursiveParameter (candidatePrimitivePhysicalBudgetExponent s 1) (allocatedAffineCanonicalBudget s B B) := by unfold finiteFreezingRecursiveParameter positivity have hrecUpper : finiteFreezingRecursiveParameter (candidatePrimitivePhysicalBudgetExponent s 1) (allocatedAffineCanonicalBudget s p0 pFull) ≤ (allocatedAffineCanonicalBackendPolynomial s).eval₂ (Nat.castRingHom ℝ) B := by rw [allocatedAffineCanonicalBackendPolynomial_eval s hB] linarith only [hrec, hd] constructor · rw [allocatedAffineCanonicalBackendPolynomial_eval s hB] linarith only [hdiag, hrec0] · exact hrecUpper · exact ((candidatePrimitiveFreezingCutoff_le_budget s 1 hp).trans (power_le_recursiveParameter _ hp)).trans hrecUpper · exact (allocatedAffineCanonical_cutoffCost_le_recursive s hp0 hFull).trans hrecUpper
theorem exists_allocatedAffineCanonicalBackend_budget (s : ℕ) : ∃ C : ℕ, 2 ≤ C ��� ∀ (B p0 pFull : ℝ), 0 ≤ p0 → 0 ≤ pFull → p0 ≤ B → pFull ≤ B → AllocatedAffineCanonicalBackendBounds s p0 pFull ((B + C) ^ C) := by obtain ⟨C, hC, hbound⟩ := exists_natPolynomial_eval_budget (allocatedAffineCanonicalBackendPolynomial s) refine ⟨C, hC, ?_⟩ intro B p0 pFull hp0 hFull hp0B hFullB have hb := allocatedAffineCanonicalBackendPolynomial_bounds s hp0 hFull hp0B hFullB have hpoly := hbound B (hp0.trans hp0B) exact ⟨hb.canonical.trans hpoly, hb.recursive.trans hpoly, hb.cutoff.trans hpoly, hb.cutoff_cost.trans hpoly⟩
noncomputable def allocatedAffineCanonicalBackendExponent (s : ℕ) : ℕ := (exists_allocatedAffineCanonicalBackend_budget s).choose
theorem allocatedAffineCanonicalBackendExponent_ge_two (s : ℕ) : 2 ≤ allocatedAffineCanonicalBackendExponent s := (exists_allocatedAffineCanonicalBackend_budget s).choose_spec.1
theorem allocatedAffineCanonicalBackend_bounds (s : ℕ) {B p0 pFull : ℝ} (hp0 : 0 ≤ p0) (hFull : 0 ≤ pFull) (hp0B : p0 ≤ B) (hFullB : pFull ≤ B) : AllocatedAffineCanonicalBackendBounds s p0 pFull ((B + allocatedAffineCanonicalBackendExponent s) ^ allocatedAffineCanonicalBackendExponent s) := (exists_allocatedAffineCanonicalBackend_budget s).choose_spec.2 B p0 pFull hp0 hFull hp0B hFullB
end Erdos3.VectorPolynomial
end
end OAIlean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientCoverTilt.leanAdded+602
lean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientLaw.leanAdded+313
lean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientReindex.leanAdded+69
lean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientResidueWidths.leanAdded+553
lean/OAI/Combinatorics/Progressions/Lattices/AffineCoefficientSubspace.leanAdded+584
lean/OAI/Combinatorics/Progressions/Lattices/AffineCommonReferenceBudget.leanAdded+120
lean/OAI/Combinatorics/Progressions/Lattices/AffineCoveredJetDensity.leanAdded+213
lean/OAI/Combinatorics/Progressions/Lattices/AffineCoveredSiteValues.leanAdded+99
lean/OAI/Combinatorics/Progressions/Lattices/AffineCubeCoordinates.leanAdded+46
lean/OAI/Combinatorics/Progressions/Lattices/AffineCubeCoveredProjection.leanAdded+84
lean/OAI/Combinatorics/Progressions/Lattices/AffineCubeMinorGoodMass.leanAdded+622
lean/OAI/Combinatorics/Progressions/Lattices/AffineCubePlateauSite.leanAdded+103
lean/OAI/Combinatorics/Progressions/Lattices/AffineCubePositiveComparison.leanAdded+361
lean/OAI/Combinatorics/Progressions/Lattices/AffineCubeUniformRemoval.leanAdded+222
lean/OAI/Combinatorics/Progressions/Lattices/AffineIntervalNormalizedBounds.leanAdded+42
lean/OAI/Combinatorics/Progressions/Lattices/AffineKernelEndpointGeometry.leanAdded+151
lean/OAI/Combinatorics/Progressions/Lattices/AffineKernelResidueRetained.leanAdded+324
lean/OAI/Combinatorics/Progressions/Lattices/AffineLayeredModeReduction.leanAdded+53
lean/OAI/Combinatorics/Progressions/Lattices/AffineLiftInsertion.leanAdded+94
lean/OAI/Combinatorics/Progressions/Lattices/AffineLowestLayer.leanAdded+84
lean/OAI/Combinatorics/Progressions/Lattices/AffineMaskedInitialShell.leanAdded+548
lean/OAI/Combinatorics/Progressions/Lattices/AffineMeshRetention.leanAdded+646
lean/OAI/Combinatorics/Progressions/Lattices/AffineMeshScalarTail.leanAdded+336
lean/OAI/Combinatorics/Progressions/Lattices/AffineModerateGeometricApproximation.leanAdded+243
lean/OAI/Combinatorics/Progressions/Lattices/AffineModeratePlateauModel.leanAdded+492
lean/OAI/Combinatorics/Progressions/Lattices/AffineModeratePlateauSite.leanAdded+64
lean/OAI/Combinatorics/Progressions/Lattices/AffineNormalizedScales.leanAdded+49
lean/OAI/Combinatorics/Progressions/Lattices/AffineObservedTransport.leanAdded+80
lean/OAI/Combinatorics/Progressions/Lattices/AffineOneSiteNormalizedLaw.leanAdded+521
lean/OAI/Combinatorics/Progressions/Lattices/AffinePrecisionBudget.leanAdded+289
lean/OAI/Combinatorics/Progressions/Lattices/AffinePrimitiveLogBudget.leanAdded+107
lean/OAI/Combinatorics/Progressions/Lattices/AffineProfileTranslationL1.leanAdded+45
lean/OAI/Combinatorics/Progressions/Lattices/AffineRefinedCoefficients.leanAdded+33
lean/OAI/Combinatorics/Progressions/Lattices/AffineResidualRecovery.leanAdded+71
lean/OAI/Combinatorics/Progressions/Lattices/AffineResidueAccuracy.leanAdded+79
lean/OAI/Combinatorics/Progressions/Lattices/AffineResidueCoordinateEquiv.leanAdded+31
lean/OAI/Combinatorics/Progressions/Lattices/AffineSampleAlphabet.leanAdded+635
lean/OAI/Combinatorics/Progressions/Lattices/AffineSiteCoverTilt.leanAdded+84
lean/OAI/Combinatorics/Progressions/Lattices/AffineSliceC2Difference.leanAdded+132
lean/OAI/Combinatorics/Progressions/Lattices/AffineSourceAccuracy.leanAdded+59
lean/OAI/Combinatorics/Progressions/Lattices/AffineSquareErrorAccuracy.leanAdded+42
lean/OAI/Combinatorics/Progressions/Lattices/AffineTopCoefficient.leanAdded+97
lean/OAI/Combinatorics/Progressions/Lattices/AffineWindowGoodKernelBound.leanAdded+316
lean/OAI/Combinatorics/Progressions/Lattices/AlgebraicMajorIntegerRestoration.leanAdded+167
lean/OAI/Combinatorics/Progressions/Lattices/AlgebraicMajorWeightedAffineTopPullback.leanAdded+528
lean/OAI/Combinatorics/Progressions/Lattices/AllocatedActiveResidueComparison.leanAdded+436
lean/OAI/Combinatorics/Progressions/Lattices/AllocatedActiveResiduePointMass.leanAdded+104
lean/OAI/Combinatorics/Progressions/Lattices/AllocatedActualCRTRationalMarginal.leanAdded+86
lean/OAI/Combinatorics/Progressions/Lattices/AllocatedAffineAnalyticBudget.leanAdded+325
lean/OAI/Combinatorics/Progressions/Lattices/AllocatedAffineCanonicalBackendBudget.leanAdded+409